Subject: Re: Retrieving Distinct text From: "Pete Johnston" <P.Johnston@xxxxxxxxxxxxxxxxxx> Date: Thu, 15 Jul 1999 10:43:49 GMT |
[Amit Khemka] > Is it possible using XSL, to extract Distinct Values for a given element. [example snipped] I'm sure there are more elegant solutions, but I think something like the following should work for your example: <xsl:template match="companies"> <xsl:apply-templates> <xsl:sort select="city"/> </xsl:apply-templates> </xsl:template> <xsl:template match="company"> <xsl:variable name="x" expr="city"/> <xsl:if test='not(from-following-siblings(*[city=$x]))'> <xsl:value-of select="city"/> <xsl:if test="not(position()=last())"><xsl:text>, </xsl:text></xsl:if> </xsl:if> </xsl:template> Pete Johnston University of Glasgow ==================================================== Pete Johnston (Effective Records Management Project) Archives & Business Records Centre University of Glasgow 77-87 Dumbarton Road Glasgow G11 6PW E-Mail: p.johnston@xxxxxxxxxxxxxxxxxx Scotland, U.K. URL: http://www.gla.ac.uk/InfoStrat/ERM/ Tel: (UK) 0141 339 8855 ext. 0166 or (UK) 0141-330-4159 Fax: (UK) 0141-330-4158 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Retrieving Distinct text, Amit Khemka | Thread | RE: Retrieving Distinct text, Kay Michael |
Re: New XSLT draft, Alistair MacDonald | Date | Possible to use attribute value in , Lionel Villard |
Month |