Leaf Document

Leaf Document

Leaf documents are VoiceXML documents that make reference to a root document, which is also a VoiceXML document. Leaf documents are used in conjunction with a root document to organize VoiceXML scripts in a structured manner. This organized structure of scripts aids IVR developers from having to write all of their VoiceXML IVR code all in one script and allows for easier code management for debugging purposes.

The following example demonstrates the use of a root document, root.vxml, and its leaf documents, Page1.vxml and Page2.vxml:

root.vxml: <?xml version="1.0"?> <vxml version="2.0"> <var name="foo"/> <form> <block> <prompt bargein="false"> The value leaf is set to <value expr="leaf"/>. </prompt> </block> </form> </vxml>
Page1.vxml: <?xml version="1.0"?> <vxml version="2.0" application="root.vxml"> <form> <block> <assign name="foo" expr="'bar'"/> <goto next="Page2.vxml" maxage="0" maxstale="0"/> </block> </form> </vxml>
Page2.vxml: <?xml version="1.0"?> <vxml version="2.0" application="root.vxml"> <var name="leaf"/> <form> <block> <assign name="leaf" expr="'rab'"/> <prompt bargein="false"> The value foo is set to <value expr="foo"/> </prompt> <goto next="root.vxml" maxage="0" maxstale="0"/> </block> </form> </vxml>

From this example, note how the leaf documents reference the root document in the application attribute of the <vxml/> tag:
<vxml version="2.0" application="root.vxml">

When the IVR application, Page1.vxml, is started, it accesses the variable, "foo", from the root document, root.vxml, and assigns it the value of string, "bar". Page1.vxml then transitions to Page2.vxml, which creates a new variable, "leaf", and assigns it the value of string, "rab". Page2.vxml then returns the prompt, "The value of foo is set to bar." After the prompt, Page2.vxml transitions to the root document, root.vxml, which references the variable, "leaf", from Page2.vxml and returns the prompt, "The value leaf is set to rab." This makes it possible for root documents to reference variables from leaf documents as long as the leaf documents reference the root document.

Related links

Related terms

for "Leaf Document"

Search Glossary

Term of the Day

Within telecommunications, fault tolerance is an operational design that enables some components of a system to remain functional, even after others fail.