Try:
<xsl:for-each-group select="$list" group-by=".">
<xsl:sequence select="current-group()[last()=1]"/>
</xsl:for-each-group>
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
-----Original Message-----
From: Houghton,Andrew [mailto:houghtoa(_at_)oclc(_dot_)org]
Sent: 05 January 2010 18:41
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Retrieving sequence of unique strings from
another sequence
I have a sequence of strings, e.g., ('abc', 'def', 'def',
'ghi'), and I want to create a new sequence that will have
only the unique strings in it. The XSL 2.0 function
distinct-values is not what I want because:
<xsl:variable name="list" as="xsd:string*" select="('abc',
'def', 'def', 'ghi')" />
<xsl:variable name="uniq" as="xsd:string*"
select="distinct-values($list)" />
will result in a sequence of ('abc', 'def', 'ghi') which is
not what I'm looking for. What I am looking for is the
sequence ('abc', 'ghi'). Unix people will recognize that
distinct-values() returns the result of the uniq command
without any options. While what I'm looking for is the
result of the uniq command with the -u option.
Can anyone suggest how I might use one or more XSL 2.0
functions to return only the unique strings.
Thanks, Andy.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--