The basic implementation is very simple:
- execute the expression from the 'test'-attribute
- evaluate the resulting boolean value
- ignore the element contents if the value is 'false'
- otherwise execute the element contents
There is onle type of function call that makes this a bit more complicated.
function calls can be used to test for extension elements and functions. A
very common use for these is to encapsulate all references to extension
elements inside an
<xsl:if> element and test for the
existance of this element before attempting to use it. XSLTC has to support
this. Otherwise we may risk either outputting erronuous error or warning
messages about acessing non-existing elements, or even worse, compiling in
calls to non-existing methods in the translet, causing the JVM's verifier to
prevent the translet from being loaded.
functions have been updated to perform an evaluation at compile-time, so that
If class can know wether to compile in calls to extensions or
not. This is possible because both functions take only literal expressions as
parameters. See the
getResult() methods of the
classes for details.