[xsl] A riddle...

Subject: [xsl] A riddle...
From: Christian Cäsar <caesar@xxxxxxxxxxxx>
Date: Fri, 16 Nov 2001 12:12:27 +0100
Hello all,

i don't see the solution, although there must be one.

I'm transforming XML to HTML. This is an example XML:

  <leaf idUeber="102149" />
  <node idUeber="102150">
   <leaf idUeber="102160" />
   <leaf idUeber="102165" />
   <leaf idUeber="102166" />
   <leaf idUeber="102173" />
   <leaf idUeber="102174" />
   <leaf idUeber="102175" />
  <leaf idUeber="102151" />
  . etc...
  <Menuestruktur webID="102149">
  <Menuestruktur webID="102150">
  <Menuestruktur webID="102151">
  <Menuestruktur webID="102152">
  . etc...

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.


<xsl:apply-templates select="/root/objects/Menuestruktur

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,

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread