RE: extracting unique elements

Subject: RE: extracting unique elements
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 28 Jan 2000 09:46:48 -0000
> 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>

Don't try it with the new Microsoft product, it doesn't support "preceding".

> for example if i had the following xml document:
> 
> <SALESFORCE>
>      <SALESPERSON NAME="BOB">
>           <CUSTOMER CODE="1">ACME</CUSTOMER>
>           <CUSTOMER CODE="2">BLAMMO</CUSTOMER>
>      </SALESPERSON>
>      <SALESPERSON NAME="TODD">
>           <CUSTOMER CODE="1">ACME</CUSTOMER>
>           <CUSTOMER CODE="3">KABLOOEY</CUSTOMER>
>      </SALESPERSON>
>      <SALESPERSON NAME="BETTY">
>           <CUSTOMER CODE="4">JUICY JUICY</CUSTOMER>
>           <CUSTOMER CODE="2">BLAMMO</CUSTOMER>
>      </SALESPERSON>
> </SALESFORCE>
> 
> I would want to only display:
> 
> ACME
> BLAMMO
> KABLOOEY
> JUICY JUICY


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


Current Thread