dcsimg
Is it possible to use XSLT to remove elements with...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Peter_Mularien
Posted On:   Thursday, March 1, 2001 11:21 AM

Is it possible to use XSLT to remove elements with
duplicate values from an XML file?



For example, given the following:

			

A
B
A
C
B


And produce the output (order of elements is not
important, but uniqueness is):

			

A
B
C

Yes, using the <tt>preceding-sibling</tt> axis.

Posted By:   Anonymous  
Posted On:   Saturday, September 29, 2001 10:43 PM

XSLT does not currently provide a direct way of extracting unique nodes from a nodeset but that feature can be emulated. The trick would be to ask at each node if there has been another one. This would work:










About | Sitemap | Contact