This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Set of distinct values
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Set of distinct values
- From: Xiaocun Xu <xiaocunxu at yahoo dot com>
- Date: Thu, 31 May 2001 12:24:25 -0700 (PDT)
- Cc: jmacki at iisd dot ca
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi, Jason:
You can achieve what you needed using preceding axis
like the following:
<distinct>
<xsl:for-each
select="root/node[not(.=preceding::node)]">
<node><xsl:value-of select="."/></node>
</xsl:for-each>
</distinct>
Xiaocun
--- Jason Macki <jmacki@iisd.ca> wrote:
> Hello,
>
> I was wondering anyone can suggest a way that XSL
> can select a set of
> distinct values from an XML document, similar to a
> "Select DISTINCT"
> command in SQL.
>
> For example, I'd like to transform this:
>
> <root>
> <node>a</node>
> <node>b</node>
> <node>c</node>
> <node>a</node>
> <node>b</node>
> <node>c</node>
> <node>a</node>
> <node>b</node>
> <node>c</node>
> <node>a</node>
> <node>b</node>
> <node>c</node>
> <node>d</node>
> </root>
>
> Into this =>
>
> <distinct>
> <node>a</node>
> <node>b</node>
> <node>c</node>
> <node>d</node>
> </distinct>
>
> Thanks,
> Jason
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list