This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: extracting unique elements
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: extracting unique elements
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Fri, 4 Feb 2000 18:08:10 -0000
- Reply-To: xsl-list at mulberrytech dot com
> >> Is there any easy way to select only the unique elements from
> >> an xml document.
> >
> ><xsl:for-each select="//CUSTOMER[not(.=preceding::CUSTOMER)]">
> ><xsl:value-of select="."/>
> ></xsl:for-each>
>
> Doesn't this require the CUSTOMER elements to be sorted?
>
No. you're testing whether the value is the same as ANY preceding customer,
not just the immediately preceding customer. For the latter you would write:
select="//CUSTOMER[not(.=preceding::CUSTOMER[1])]"
MHK
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list