Ejen Logo
 
   <foreach>


Description
Foreach node is similar to the <xsl:for-each> instruction. It allows iteration on a set of XML sub-trees. This is the only node in Ejen that changes current node context (like the XSL for-each instruction).
 
The select attribute may be any valid XPath expression (either absolute or relative to the current node).
 
...
<foreach select="class-definition[@language='java']">
  <filter uri="java-prepare.xsl"/>
  ...
  <template uri="java-output.xsl" save="{@name}.java"/>
  ...
</foreach>
...

Here, foreach child nodes (eg: template, filter, ...) will be applied to each class-definition sub-tree whose language attribute is set to "java".
 
Note that even if the foreach node changes current node context, the entire XML tree is always accessible in template and filter stylesheets by the mean of a "root" parameter (see param node).

Attribute Summary
 
NameDefault ValueOptionalAccepted Values
base true 
select 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.
select
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