Re: [xsl] XSL Processing to avoid repetitions

Subject: Re: [xsl] XSL Processing to avoid repetitions
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 16 Jun 2010 14:22:37 +0100
On 16 June 2010 14:15, Fabien Tillier <f.tillier@xxxxxxxx> wrote:
> Hi List.
> I was wondering if anyone could help me to filter out data in an XML
stream.
> (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

Use xsl:for-each-group to select <city> and group by <name>, and
within that use current-grouping-key() to get place and then for-each
over the current-group() to get each name.

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

...in which case its probably best to post a complete sample.


--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread