[xsl] Compare current node with the last node in a sorted for-each list

Subject: [xsl] Compare current node with the last node in a sorted for-each list
From: TBrouwer@xxxxxxxxxxxxxxxxxxx
Date: Mon, 21 May 2001 14:20:58 +0200
Example:
<node1>
     <node2 attr="name4" extra="test1"/>
     <other>More1</other>
     <x>X</x>
     <y>Y</y>
     <node2 attr="name3" extra="test2"/>
     <s>S</s>
     <other>More2</other>
     <node2 attr="name2" extra="test1"/>
     <other>More3</other>
     <node2 attr="name1" extra="test1"/>
     <z>Z</z>
     <other>More4</other>
</node1>

Is it possible to display all 'node2' in alphabetic order based on the
value of the 'attr' attribute? Further, as the value of the attribute
'extra' is the same as the node before in the sorted list, then print an
extra line under that node with <same />

Wanted output:
<node2 attr="name1" extra="test1"/>
<node2 attr="name2" extra="test1"/>
<same/>
<node2 attr="name3" extra="test2"/>
<node2 attr="name4" extra="test1"/>

Thanks in advance for any suggestions....


T. Brouwer.





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread