Tag node position in XDS document

The following style-sheet processes each <status> node present within an XDS document, and tags each node with the position of that node. For example, if the XDS document contains 3 <status> nodes, the 1st node will be rewritten as <status position=”0″> etc. The code listed below makes use of the XSLT function preceding-sibling in order to figure out at what position the node is placed within the context of the XDS document. The code loops around each node, one after the other, and tags each node with the relative position.

I used the code below to ensure that multiple email notifications were not sent out when processing an XDS document with multiple <status> tags.