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

Re: Concatenate and unique values

Subject: Re: Concatenate and unique values
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Fri, 12 Nov 2004 16:23:52 +0100
xslt concatenate
Should related to the grouping problem that is discussed on various places. Look for instance at http://www.jenitennison.com/xslt/index.html

Basically you need a key that holds all combinations and then use generate-id to pick the first of each unique combination.

(top level)
<xsl:key name="diseases" match="Disease" use="concat(SymptomNum, '-', Pulse, '-', HeartBeat)" />

<xsl:template match="Disease">
<xsl:if test="generate-id(.) = generate-id(key('diseases', concat(SymptomNum, '-', Pulse, '-', HeartBeat)[1])">
<!-- show the disease, this is the first of the unique combination -->

Or replace the xsl:template by the for-each if you prefer that...


pnayak@xxxxxxx wrote:

Hi All

SymptomNum is sequential from 0 till the number of rows of data. Each row has SymptomNum, Pulse and Heart-beat. Across all the SymptomNum, I want to find the unqiue combinations of Pulse and Heart-beat existing in the data. There may be repitions, so I want to ignore them.

<xsl:for-each select="//Health/Disease[(./SymptomNum)>=0]">

<xsl:variable name="current-sym-num" select="./SymptomNum"/>

<xsl:variable name="pulse-val" select="./Pulse"/>

<xsl:variable name="heart-beat-val" select="./HeartBeat"/>

<xsl:variable name="sym-summary" select="concat($pulse-val, ' ', $heart-beat-val)"/>

<!-- Display all unique combinations of pulse-val and heart-beat-val -->

<xsl:if test="$pulse-val and $heart-beat-val">

How do i find that this current combination of pulse-val and heart-beat-val is unique?



I have been using this logic to get unique values of pulse values:

<xsl:variable name="unique-pulse-num" select="//Health/Disease/Pulse[not(.=following::Pulse)]" />

<xsl:for-each select="$unique-pulse-num">

<xsl:value-of select="." />,


Can this logic be extended to multiple attributes of an element? Can anyone help me with this logic? Thanks in advance,


-- Geert.Josten@xxxxxxxxxxx IT-consultant at Daidalos BV, Zoetermeer (NL)


GPG: 1024D/12DEBB50

Current Thread


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.
First Name
Last Name
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.