[JET2] <c:iterate> tag bahavior [message #17181] |
Wed, 23 May 2007 15:59 |
Eclipse User |
|
|
|
Originally posted by: vincent.lg.voila.fr
Hi,
I was implementing a custom iterating tag (with sorting feature) and
realized the <c:iterate> tag has not the behavior one might expect. Please
see the simple example below :
An xml file to be transformed :
<?xml version="1.0" ?>
<root>
<book>
<section value="1">
<section value="1.1">
<section value="1.1.1"/>
<section value="1.1.2"/>
</section>
<section value="1.2">
<section value="1.2.1"/>
<section value="1.2.2"/>
</section>
</section>
<section value="2">
<section value="2.1">
<section value="2.1.1"/>
<section value="2.1.2"/>
</section>
</section>
</book>
</root>
The jet template :
<c:iterate select="//book//section" var="sec">
section <c:get select="$sec/@value"/>
</c:iterate>
and the output :
section 1
section 2
section 1.1
section 1.2
section 1.1.1
section 1.1.2
section 1.2.1
section 1.2.2
section 2.1
section 2.1.1
section 2.1.2
As one can see, the output is a bit strange, as I was expecting the output
to be in the same order as in the xml input file.
AFAIK, the xpath tag <xsl:for-each> would have printed the good result, no
?
Is there a way to use the iterate tag to print nodes in the correct order ?
Thanks.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05237 seconds