title: Invalid rule reference error when compiling Windows Speech Recognition Macros
body: <p>Lately I have gotten interested in trying out some XML and Javascript with Windows Speech Recognition Macros. This is my first experience with both languages, but since I do have a small programming history, I thought that I could just dive in. And so far it has gone pretty well. But now that I am trying to implement a deeper level of interactivity to my macros I start running into errors of which I can find no explaination online, so I came here to ask for your help.</p>
  
  <p>This is the macro that is giving me problems:</p>
  
  <pre><code>&lt;command&gt;
      &lt;listenFor&gt;Whats the weather like in [CityName]&lt;/listenFor&gt;
      &lt;script language="JScript"&gt;
          &lt;![CDATA[
              var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
              xml_doc.async = false;
              xml_doc.load("http://api.openweathermap.org/data/2.5/weather?q={[CityName]}&amp;mode=xml");
  
              var city = xml_doc.getElementByTagName("city").getAttribute("name");
              var temperature = xml_doc.getElementByTagName("temperature");
  
              Application.Speak(city);
          ]]&gt;
      &lt;/script&gt;
  &lt;/command&gt;
  </code></pre>
  
  <p>And this is the error message:</p>
  
  <pre><code>Error compiling grammar for speech Macros:
  "AI-base.WSRMac"
  ==========
  Line 40: 80045048 - Invalid rule reference to &lt;RULEREF NAME="CityName" REFID=""/&gt;
  ==========
  00001:
  00002: &lt;GRAMMAR LANGID="0409"&gt;
  ...
  ...
  ...
  00038: &lt;RULE NAME="Rule_8"&gt;
  00039:  &lt;P&gt;
  00040:   &lt;p&gt;Whats the weather like in &lt;/p&gt;&lt;ruleref name="CityName" propname="CityName" /&gt;
  00041:  &lt;/P&gt;
  00042: &lt;/RULE&gt;
  00043: &lt;RULE name="build:namedDictation"&gt;&lt;dictation min="1" max="10"/&gt;&lt;/RULE&gt;
  00044: &lt;/GRAMMAR&gt;
  </code></pre>
  
  <p>What I am trying to do with this macro is get a cityname from the user and get the weather for that location, out it in a couple of variables and then let it tell me the weather in a format I like.</p>
  
  <p>Could someone please explain what I am doing wrong and how to fix it?</p>
  
  <p>Thanks in advance :)
  -Dirk</p>