I need to generate a incremental sequence number like the one below. If you could see the sequence number attribute below, it doesn't have a proper order, in some places it occurs in descendant node and some places in different order. Is there any generic code to generate this sequence number.
Currently, I tried using the below ways but these didn't work. Any help would be appreciated.
- xsl:value-of select="preceding-sibling::@[SeqNum]/@n"
- SeqNum="{format-number(count(preceding@SeqNum)+1,'0000')}"
Sample XML:
<act>
<ActAssociation ***SeqNum="1"***>
<InitialRptIndicator>Y</InitialRptIndicator>
</ActAssociation>
<Party ***SeqNum="2"***>
<ActPartyTypeCode>35</ActPartyTypeCode>
<PartyName ***SeqNum="3"***>
<PartyNameTypeCode>L</PartyNameTypeCode>
</PartyName>
</Party>
<Party SeqNum="4">
<PartyName SeqNum="5">
<fc2:PartyNameTypeCode>L</fc2:PartyNameTypeCode>
</PartyName>
</act>
SeqNumattribute already and you only need to fix the values? Or do you need to add that attribute? If so, to which elements exactly?fc2:Partybut not to others likefc2:Activityorfc2:FilingDateText. So how do you decide or want the XSLT program to decide where to add the attribute?