[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Retrieving Distinct text

Subject: Re: Retrieving Distinct text
From: "Pete Johnston" <P.Johnston@xxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jul 1999 10:43:49 GMT
distinct xslt
[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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.