[xsl] Numbering similar nodes sequentially in the output

Subject: [xsl] Numbering similar nodes sequentially in the output
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Wed, 12 Oct 2011 13:32:17 -0700
I suspect this cannot be done, but will ask. Is it possible to sequentially number similar nodes in the output? For instance, part of my current output is:

<FormatPage souvenir-sheet="365">
  <FormatButtons>
    <Formats se-tenant="365"/>
    <Formats coupon="367"/>
    <Formats coupon="368"/>
  </FormatButtons>
</FormatPage>

I would like to make that
<FormatPage souvenir-sheet="365">
  <FormatButtons>
    <Formats se-tenant="365"/>
    <Formats label='1' coupon="367"/>
    <Formats label="2" coupon="368"/>
  </FormatButtons>
</FormatPage>

or, for a more complex example, an output of
<FormatPage souvenir-sheet="365">
  <FormatButtons>
    <Formats label='1' se-tenant="365"/>
   <Formats label='2' se-tenant="367"/>
    <Formats label='1' coupon="367"/>
    <Formats label='2' coupon="368"/>
  </FormatButtons>
</FormatPage>

That is, inserting a sequential label attribute in the <Formats> that have the same attribute. The original position() of the <Formats> in the input file is most likely irrelevant and misleading, and I suspect trying to count the different input <Formats> may be just as useless. My only interest is in sequentially numbering multiple <Formats> bearing the same attribute. If this might be possible, I can submit for a selected set of sample inputs, the output and current stylesheet. Otherwise, I'll just give up on it. Only se-tenant and coupon attributes require this treatment.
Thanks,
Mark


Current Thread