[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

A riddle...

Subject: A riddle...
From: Christian Cäsar <caesar@xxxxxxxxxxxx>
Date: Fri, 16 Nov 2001 12:12:27 +0100
leaf riddle
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.