src Attribute
Specifies the Uniform Resource Identifiers (URI) of the external grammar file. Optional.
HTML | <grammar src="src#ruleID"> |
JScript | grammar.src = src |
Remarks
The grammar element must specify only one grammar resource. If a grammar element contains an inline grammar, use of the src attribute is invalid and results in an invalid document.
When referring to an external grammar file, it is possible to refer directly to a rule below the root rule using a standard syntax. Assume that the following external grammar file (airport.grxml) is being used.
<grammar version="1.0" tag-format="semantics-ms/1.0" xmlns="http://www.w3.org/2001/06/grammar" root="Airports" lang="en-US">
<rule id="Airports">
<one-of>
<item>Heathrow</item>
<item>Gatwick</item>
<item>San Diego</item>
</one-of>
<one-of>
<item repeat="0-1">
<ruleref uri="#FlightDay" />
</item>
</one-of>
</rule>
<rule id="FlightDay">
on
<one-of>
<item>Monday</item>
<item>Wednesday</item>
<item>Friday</item>
</one-of>
</rule>
</grammar>
There are two rules within this grammar. Use the following syntax to refer directly to the FlightDay rule.
<grammar src="airport.grxml#FlightDay">
Example
The following code demonstrates the use of the src attribute.
<salt:grammar src="cities.grxml" type="application/srgs+xml" />