xsl-list
[Top] [All Lists]

[xsl] Numbering similar nodes sequentially in the output

2011-10-12 15:32:18
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




--~------------------------------------------------------------------
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>
--~--