[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
On 4/11/07, Waters, Tyler S FOR:EX <Tyler.Waters@xxxxxxxxx> wrote:
This is a XSLT 1.0 technique to get unique values (known as Muenchian method):
With XSLT 2.0, you can use distinct-values function:
Re: [xsl] Writing a SELECT with each OPTION a unique value
Subject: Re: [xsl] Writing a SELECT with each OPTION a unique value From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Wed, 11 Apr 2007 07:30:52 +0530 |
On 4/11/07, Waters, Tyler S FOR:EX <Tyler.Waters@xxxxxxxxx> wrote:
<?xml version="1.0" encoding="ISO8859-1" ?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tylor</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG> <xsl:key name="KEY_COUNTRY" match="CD" use="COUNTRY" /> -- indexes all the items based on country
This is a XSLT 1.0 technique to get unique values (known as Muenchian method):
<xsl:for-each select="CATALOG/CD[generate-id() = generate-id(key('KEY_COUNTRY', COUNTRY)[1])]"> <xsl:value-of select="COUNTRY" /><br/> </xsl:for-each>
With XSLT 2.0, you can use distinct-values function:
<xsl:for-each select="distinct-values(CATALOG/CD/COUNTRY)"> <xsl:value-of select="." /><br/> </xsl:for-each>
-- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Writing a SELECT with each OP, Waters, Tyler S FOR: | Thread | [xsl] Is there a way to avoid Empty, binu.idicula |
[xsl] Writing a SELECT with each OP, Waters, Tyler S FOR: | Date | [xsl] Selecting content via attribu, Ben Trafford |
Month |
Keywords