Revision [548]

This is an old revision of HowToXMLCondition made by DavidLee on 2009-05-21 19:19:16.

 

How To use an XML Expression as a condition


XML expressions can be used in conditionals in several ways. The most direct way is a boolean xml expression using the test command.

Using the test command


XML Expressions used in the test command are evaluated in boolean context. For example, this (admitedly verbose syntax) expression tests the xml true expression. When an XML expression is used as the sole argument to the test command ("[ expr ]") it is converted to a boolean value following the xpath rules.

[ <[ fn:true() ]> ] && Echo Is True


A more useful example tests if a sequence is the empty sequence.
foo=(a sequence)
[ <[ $foo ]> ] && echo foo is not the empty sequence
foo=()
[ <[ $foo ]> ] || echo foo is the empty sequence



There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki