Hi,
It is possible to load a rule from an external grammar file. We've modified the basic example from the ruleref documentation itself as a sample. If this example does not help you determine what might be the issue in your case, please post what you can of your specific grammar file and we'll try and give you some insight as to what might be the issue.
test.vxml
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form id="start">
<field name="test_field">
<grammar root="main" type="application/srgs+xml" version="1.0" mode="voice">
<rule id="main" scope="public">
<item>
<ruleref uri="http://example.com/test_grammar.grxml#month"/>
</item>
<tag> month = month.SWI_literal; </tag>
</rule>
</grammar>
<prompt>Please say a month.</prompt>
<filled>
<prompt bargein="false">
I think you said <value expr="test_field.month"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
And then the external grammar file (test_grammar.grxml):
Code: Select all
<?xml version="1.0"?>
<grammar root="month" version="1.0" xml:lang="en-US">
<rule id="month" scope="public">
<one-of>
<item>May</item>
<item>June</item>
<item>October</item>
</one-of>
</rule>
</grammar>
If you were to call and say June, May, or October, this will work as expected.
We have found that attempting to use a relative path (when the file is in the same directory), such as:
Code: Select all
<ruleref uri="test_grammar.grxml#month"/>
does not work, and it needs to be a valid URI (or just #item, if the rule is in the same file).
Please let us know if you have any questions.
Regards,
Plum Support