26.01.2019 Views

XML Simplified

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Module 7<br />

More on XSLT<br />

Concepts<br />

Number<br />

Result tree fragment<br />

True unless the value is zero or NaN (not a number).<br />

Always true, because every fragment contains at least one node, its root node.<br />

Table 7.5: Boolean Conversion Rules<br />

Certain operators compare numerical values to arrive at a Boolean value. All the nodes in a node-set are<br />

tested to determine whether any of them satisfies the comparison or not. The Comparison operators are<br />

shown in table 7.6.<br />

Operator<br />

expr = expr<br />

expr != expr<br />

expr < expr<br />

expr > expr<br />

expr = expr<br />

Returns<br />

True if both expressions (string or numeric) have the same value, otherwise false.<br />

True if the expressions do not have the same value (string or numeric), otherwise false.<br />

True if the value of the first numeric expression is less than the value of the second,<br />

otherwise false.<br />

True if the value of the first numeric expression is greater than the value of the second,<br />

otherwise false.<br />

True if the value of the first numeric expression is less than or equal to the value of the<br />

second, otherwise false.<br />

True if the value of the first numeric expression is greater than or equal to the value of<br />

the second, otherwise false.<br />

Table 7.6: Comparison Operators<br />

Note: To use some of the comparison operators inside an <strong>XML</strong> document such as an XSLT style sheet<br />

or a schema, one must use character references &lt; and &gt; instead of < and >.<br />

The different functions that return Boolean functions are shown in table 7.7.<br />

Function<br />

expr and expr<br />

expr or expr<br />

true()<br />

false()<br />

not(expr)<br />

Returns<br />

True if both Boolean expressions are true, otherwise false.<br />

True if at least one Boolean expression is true, otherwise false.<br />

True.<br />

False.<br />

Negates the value of the Boolean expression: true if the expression is<br />

false, otherwise false.<br />

Table 7.7: Boolean Functions<br />

Version 1.0 © Aptech Limited<br />

<strong>XML</strong> <strong>Simplified</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!