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

Re: following-sibling help please.

Subject: Re: following-sibling help please.
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Tue, 10 Oct 2006 21:59:05 +0530
Re:  following-sibling help please.
You haven't told what is your desired output. But perhaps something
like following should work for you:

<xsl:template match="totaluse[following-sibling::*[1]/self::header]">
  <totaluse>
     <!-- add something -->
  </totaluse>
</xsl:template>

(this is not tested)

On 10/10/06, Danny Leblanc <leblancd@xxxxxxxxxxxxxxxxxxx> wrote:
Hello everyone,

I have a data file that is similar in structure to the one below. What I am trying to do (and failing badly) is to add a child to <totaluse> only when the node that following it is a <header>. When another <use> following it I would not like to change anything. Basically, in the software I am using this with I need to know when I am on the last <totaluse> element for the current "set" (a set starts with the <header>). I cannot add (due to software limitations) a parent around each set. Everything must be on the second level of the XML file as it is below.

I have been toying around with following-sibling:: but have not managed to figure out how to format it. I have found that following-sibling will return all the following siblings but I just need to test the very next one for its name. If the name is use I know not to add anything and if the name is header I know to add something.

I am using Saxon 8.7.3

Hopefully this makes some sense.



<root>
 <header>
   <info></info>
 </header>
 <use>
   <useinfo></useinfo>
 </use>
 <use>
   <useinfo></useinfo>
 </use>
 <use>
   <useinfo></useinfo>
 </use>
 <totaluse></totaluse>
 <use>
   <useinfo></useinfo>
 </use>
 <use>
   <useinfo></useinfo>
 </use>
 <totaluse></totaluse>
 <header>
   <info></info>
 </header>
</root>

Thank you.

Danny


--
Regards,
Mukul Gandhi

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.