Ejen Logo
 
   <if>


Description
If node is similar to the <xsl:if> instruction. It intends to provide a way to execute conditionnal instructions. Like <xsl:if> instruction, there is no else [if] corresponding statement. You must use the negation of the condition in another if node in order to get an else equivalent.
 
...
<if test=".[@language='java']">
  ...
</if>
<if test=".[@language='ada']">
  ...
</if>
<if test=".[@language!='java' and @language!='ada']">
  ...
</if>
...

This sample shows conditionnal if blocks: the first one tests if current node has a language attribute set to "java"; if this is true, child nodes of this if node will be executed; the second one is very similar, and the last one is a kind of else expression.
 
See also choose node.

Attribute Summary
 
NameDefault ValueOptionalAccepted Values
base true 
test false 

Attribute Detail
 
base
this is a generic block attribute that allows URI base redefinition: all uri attributes used in children nodes of this block will be relative to this new base definition (except if there is another child block node that redefines a new base). This is only a convenience attribute in order to simplify URI specifications. A base attribute must be a valid (well formed) URI, absolute or relative to another base definition.
test
any valid XPath expression (either absolute or relative to the current node).

Children
 
catch, choose, depends, echo, filter, finally, foreach, if, remove, save, sax, source, template, try, variable


SourceForge.net Logo