[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Retrieving Distinct text
[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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|