Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Errors (6/6) >

Overlooking of errors by a processor

The processor is not required to perform all operation defined in the stylesheet if they are not required for processing. In the example the second part of the test is multiplication by a string, which always rises a run-time error when evaluated. Because "or" operator returns "true" if at least one of its argument returns "true", processors may not evaluate the rest of the test if the first condition is matched.

In the example the source document contains value which satisfies the first argument and so the second one is not evaluated by the processor which is used for generation of this tutorial. If the letter 'a' was replaced by 'b' in the source XML document then run-time error would be raised.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="aaa">
                  <xsl:value-of  select=".='a' or 5 * . = 10"/>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>a</aaa>
Output
true


Previous chapter: Built in Types
Next chapter: Use When
Previous page: Explicit raising of errors
Next page: - - -