This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Set of distinct values


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]