| CallXML 3.0 Development Guide | Home | Frameset Home |
| expr | Data Type: STRING | Default: none - attribute is optional |
The 'expr' attribute is a powerful new addition to the CallXML 3.0 markup that allows the developer to use XPath (http://www.w3.org/TR/xpath), features within applications. When used with the <assign> element, this attribute specifies the Xpath data for identifying XML nodes via Location Paths, and the built-in Expressions, and Functions. When using Xpath, note that both the 'expr' and the 'var' and 'value' elements must be specified.' | ||
| id | Data Type: (element id) | Default: none - attribute is optional |
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur. | ||
| test | Data Type: CDATA | Default: Optional |
| The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document. | ||
| value | Data Type: STRING | Default: none - attribute is required |
| This attribute defines the variables declared value. | ||
| value-is | Data Type: STRING | Default: none - attribute is optional |
| Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution. | ||
| value-is-not | Data Type: STRING | Default: none - attribute is optional |
| Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution. | ||
| var | Data Type: (variable name) | Default: none - attribute is required |
| Variable name to use when assigning a value. Not specifying this attribute will result in a fatal error. | ||
| <?xml version="1.0" encoding="UTF-8"?> <callxml version="3.0"> <do> <assign var="MyVar" value="'Penn'"/> <prompt> our variables value is $MyVar; </prompt> </do> <do> <assign var="MyVar" value="'Teller'"/> <prompt> but now that we have changed it, our variables value is $MyVar; </prompt> </do> </callxml> |
| <callxml version="3.0"> <with label="AssignExpr"> <assign var="mydata"> <![CDATA[ <food> <lunch>greasy hamburger</lunch> <lunch>tasteless salad</lunch> <lunch>trendy sushi</lunch> <lunch>scotch and soda</lunch> </food> ]]> </assign> <assign var="todaysLunch" expr="/value/food/lunch[1]/text()" value="$mydata;"/> <say> For todays lunch, you will be having $todaysLunch; </say> </with> </callxml> |
| <?xml version="1.0" encoding="UTF-8"?> <callxml version="3.0"> <block value="B1"> <!-- declare our variable --> <assign var="V1" value="foo"/> <say>the value is $V1;</say> <log>$V1;</log> <!-- since the value attribute defined in the block is NOT 'A1' --> <!-- the assign tag below is skipped --> <assign var="V1" value="bar" value-is="A1"/> <say>the value is still $V1;</say> <log>$V1;</log> <!-- since the value attribute defined in the block IS 'B1' --> <!-- the assign tag will not be skipped --> <assign var="V1" value="foo bar" value-is="B1"/> <log>$V1;</log> <say>the value is now $V1;</say> </block> </callxml> |
| <?xml version="1.0" encoding="UTF-8"?> <callxml version="3.0"> <do> <!-- this assignation will take place, --> <!-- as foo IS equal to foo --> <assign var="MyVar" value="Vanilla Ice" test="'foo'='foo'"/> <prompt> our variables value is $MyVar; </prompt> </do> <do> <!-- this assignation will not take place, --> <!-- as foo is NOT equal to bar --> <assign var="MyVar" value="Culture Club" test="'foo' = 'bar'"/> <prompt> Lookee here, our variable has an unchanged value of $MyVar; </prompt> </do> </callxml> |
| ANNOTATIONS: EXISTING POSTS |
awirtz
|
|
| The undocumented "type" attribute (which defaults to "string") may be set to "xml" in an assignment (as in a fetch) to cause the variable in question to be parsed as XML and its contents made accessible to the XPath engine.
This mirrors the function of the "type" attribute for the "fetch" tag, except that in the case of an xml variable containing nested tags, all subsequent variable assignments get appended to the xml-type variable's value. Observe the output from the following. Code: <?xml version="1.0" encoding="UTF-8"?> <callxml version="3.0"> <assign var="myfirstvar" type="string" value="foo" /> <assign var="mysecondvar" type="string" value="<foo><bar/></foo>" /> <assign var="mythirdvar" type="xml" value="<foo>bar</foo>" /> <assign var="myfourthvar" type="xml" value="<foo><bar/></foo>" /> <assign var="myfifthvar" type="string" value="baz" /> <assign var="mysixthvar" value="frob" /> <log>myfirstvar: $myfirstvar;</log> <log>mysecondvar: $mysecondvar;</log> <log>mythirdvar: $mythirdvar;</log> <log>myfourthvar: $myfourthvar;</log> <log>myfifthvar: $myfifthvar;</log> <log>mysixthvar: $mysixthvar;</log> <exit/> </callxml> Produces: action: new assign "myfirstvar" = ("" => "foo") = "foo" action: new assign "mysecondvar" = ("" => "<foo><bar/></foo>") = "<foo><bar/></foo>" action: new assign "mythirdvar" = ("" => "<foo>bar</foo>") = "<foo>bar</foo>" action: new assign "myfourthvar" = ("" => "<foo><bar/></foo>") = "<foo><bar/></foo>" action: new assign "myfifthvar" = ("" => "baz") = "baz" action: new assign "mysixthvar" = ("" => "frob") = "frob" Log: myfirstvar: foo Log: mysecondvar: <foo><bar/></foo> Log: mythirdvar: bar Log: myfourthvar: <myfourthvar locked="false" type="xml"><bar></bar></myfourthvar><myfifthvar locked="false" type="string"><![CDATA[baz]]></myfifthvar><mysixthvar locked="false" type="string"><![CDATA[frob]]></mysixthvar> Log: myfifthvar: baz Log: mysixthvar: frob |
|
voxeojeremy
|
|
| Hi there,
Thank you for writing in about this! This is definitely an interesting issue at which I am going to have our engineering department take a look. We will post back here with updates. Thank you, Jeremy McCall Voxeo Extreme Support |
|
voxeoryanbolton
|
|
| The example given by awirtz is almost correct. There is no ability to use the '<' or '>' operators within the 'value' attribute. There are however two options:
The developer can substitute '& lt ;' and '& gt ;' for the '<' and '>' operators: or, there is CDATA: <assign var="myFood" type="xml"> <![CDATA[ <food> <lunch>greasy hamburger</lunch> <lunch>tasteless salad</lunch> <lunch>trendy sushi</lunch> <lunch>scotch and soda</lunch> </food> ]]> </assign> Using CDATA simply dosen't care what syntax is used, making it much more developer friendly. It gives the developer the same ability to create XML type variables with less headache. |
| login |