Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - distinct-values work-around for Xpath 1.0 >Thread Next - Re: distinct-values work-around for Xpath 1.0 Re: distinct-values work-around for Xpath 1.0To: NULL Date: 8/27/2009 12:47:00 PM Barnum wrote: > I'm using Xpath 1.0, so I can't use 'distinct-values'. Is there a work- > around? Alternative implementation? With the XML being e.g. <root> <foo>a</foo> <foo>b</foo> <foo>a</foo> <foo>c</foo> <foo>c</foo> <foo>d</foo> </root> the XPath /root/foo[not(. = preceding-sibling::foo)] selects only distinct 'foo' elements e.g. <foo>a</foo> <foo>b</foo> <foo>c</foo> <foo>d</foo> If you use XPath 1.0 inside XSLT 1.0 then you can also use Muenchian grouping to group and process only the first item in each group. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
