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

RE: XSL Processing to avoid repetitions

Subject: RE: XSL Processing to avoid repetitions
From: "Fabien Tillier" <f.tillier@xxxxxxxx>
Date: Wed, 16 Jun 2010 16:10:45 +0200
RE:  XSL Processing to avoid repetitions
Hi Martin.
Thanks for your answer, but it doesn't work for me.
I have resent a message with my real data.
Maybe your solution would work if I don't change it to fit my data :)
Thanks, anyway.

-----Message d'origine-----
De : Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Envoyi : mercredi 16 juin 2010 15:23
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re:  XSL Processing to avoid repetitions

Fabien Tillier wrote:
> Hi List.
> I was wondering if anyone could help me to filter out data in an XML
> (can be xslt 2.0...)
> For example, I have
> <xml>
>       <city>
>             <name>Paris</name>
>             <person>Paul</person>
>       </city>
>       <city>
>             <name>New-York</name>
>             <person>John</person>
>       </city>
>       <city>
>             <name>Paris</name>
>             <person>George</person>
>       </city>
> </xml>
> I would like to have an XSL template able to output something like (using
<OL> for example) Paris
>       Paul
>       George
> New-York
>       John
> Actually, all I am able to do is to get
> Paris
>       Paul
> New-York
>       John
> Paris
>       George

With XSLT 2.0 you can use xsl:for-each-group to group the data
   <xsl:for-each-group select="/xml/city" group-by="name">
       <xsl:value-of select="current-grouping-key()"/>
         <xsl:for-each select="current-group()/person">
           <li><xsl:value-of select="."/></li>

> (please note that the real structure is more complicated, and the filter is
to be done on more than one level...)

You will need to provide more details then.


	Martin Honnen

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.