[xsl] following-sibling help please.

Subject: [xsl] following-sibling help please.
From: "Danny Leblanc" <leblancd@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Oct 2006 12:20:56 -0400
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

Current Thread