xsl-list
[Top] [All Lists]

[xsl] following-sibling help please.

2006-10-10 09:21:09
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
 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>