Subject: [xsl] Re: Selecting distinct values based on an attribute From: "Yang" <sfyang@xxxxxxxxxxxxx> Date: Wed, 26 Sep 2001 11:14:03 +0800 |
Hi, Perry, For selecting distinct values , key and Muenchian method is one of reliable approachs, especially when dealing with a large set of data in xml file. Something like these; <!-- define key using facilitytype attribute --> <xsl:key name="facilityAtrr" match="facilities" use="@facilitytype"/> <!-- define distinct set of facilities based on facility attributes --> <xsl:variable name="facilityList" select="//facilities[count(.|key('facilityAtrr', @facilitytype)[1]) = 1]"/> <!-- data processing such as sorting,ouput...--> <xsl:template match="/"> <xsl:for-each select="$facilityList"> <xsl:sort select="@facilitytype"/> <xsl:value-of select="@facilitytype"/> </xsl:for-each> </xsl:template> Hope it is useful to your applications. Cheers, Sun-fu Yang, XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Tokenising the string usi, Joshua . Kuswadi | Thread | [xsl] Embedded Stylesheets, Sheryl Cia |
RE: [xsl] Tokenising the string usi, Joshua . Kuswadi | Date | [xsl] Embedded Stylesheets, Sheryl Cia |
Month |