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

Re: Selecting "distinct" elements

Subject: Re: Selecting "distinct" elements
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sat, 27 Sep 2003 09:52:02 +0200
xslt distinct elements
This is a simple grouping problem. An efficient solution is using the
Muenchian method for grouping.

Read about it at:
       http://www.topxml.com/code/default.asp?p=3&id=v20010129150851

or at:

       http://jenitennison.com/xslt/grouping/index.html


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Marcus Andersson" <marcan@xxxxxxx> wrote in message
news:000001c384c6$960ef6e0$0400a8c0@xxxxxxxxxxx
> Hi
> I want to select one of each element with a certain attribute value and
> loop over these elements in a for-each (or possibly apply-templates). Is
> this possible with a single select statement or do I have to make a more
> cumbersome solution? If possible, how would a statement solving the
> problem look like?
>
> Instance document:
> <root>
>  <element value="a"/>
>  <element value="b"/>
>  <element value="a"/>
>  <element value="c"/>
>  <element value="b"/>
>  <element value="d"/>
>  <element value="b"/>
> </root>
>
> XSLT Template:
> <xsl:template match="root">
>  <xsl:for-each select="[insert your favourite statement here]">
>   <anotherElt value="{@value}"/>
>  </xsl:for-each>
> </xsl:template>
>
> Resulting document:
> <root>
>  <anotherElt value="a"/>
>  <anotherElt value="b"/>
>  <anotherElt value="c"/>
>  <anotherElt value="d"/>
> </root>
>
> Thanks,
>
> /Marcus
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>




 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.