This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
A riddle...
- From: Christian Cäsar <caesar at mpdigital dot de>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Fri, 16 Nov 2001 12:12:27 +0100
- Subject: [xsl] A riddle...
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello all,
i don't see the solution, although there must be one.
I'm transforming XML to HTML. This is an example XML:
<root>
<tree>
<leaf idUeber="102149" />
<node idUeber="102150">
<leaf idUeber="102160" />
<leaf idUeber="102165" />
<leaf idUeber="102166" />
<leaf idUeber="102173" />
<leaf idUeber="102174" />
<leaf idUeber="102175" />
</node>
<leaf idUeber="102151" />
.
.
. etc...
.
</tree>
<objects>
<Menuestruktur webID="102149">
<moreinfo>
</Menuestruktur>
<Menuestruktur webID="102150">
<moreinfo>
</Menuestruktur>
<Menuestruktur webID="102151">
<moreinfo>
</Menuestruktur>
<Menuestruktur webID="102152">
<moreinfo>
</Menuestruktur>
.
.
. etc...
.
</objects>
</root>
This is what I want to do:
I want to select every Menuestruktur-Element with a webID that is found in
the tree-part of the structure as child of a 'node'-Element with a given
idUeber-Attribute stored in a variable $wid.
With
<xsl:apply-templates select="/root/objects/Menuestruktur
[@webID=/root/tree/*[@idUeber=$wid]/*/@idUeber]"/>
I manage to do that. Now comes the catch:
I just want every SECOND Menuestruktur-Element that is a leaf in the
tree-part of the XML. That is, the result should be
<Menuestruktur webID="102160"/>
<Menuestruktur webID="102166"/>
<Menuestruktur webID="102174"/>
This has something to do with position() mod 2 = 1, but I don't get it
right. Can anyone help me? Is there an alternative way?
Thanks in advance,
Christian
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list