Re: [xsl] xml to xml transform

Subject: Re: [xsl] xml to xml transform
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 16 Jan 2001 18:59:29 -0700 (MST)
Shimon Pozin wrote:
> Thanks, Mike, for the clue. However, when I tested
> this solution, I paid attention that if the source
> xml is slightly different:
> <rows>
>   <row fld="f1" value="v1"/>
>   <row fld="f1" value="v2"/>
>   <row fld="f2" value="v3"/>
>   <row fld="f1" value="v2"/>
>   <row fld="f3" value="v4"/>
> </rows>
> then this solution will not work since f1 comes after f2
> and in this case I'll see two elements f1 rather than one.

With that XML and my stylesheet, I get the following result, which is
exactly what you wanted:

<?xml version="1.0" encoding="utf-8"?>

> Should I sort the entire collection before I use this
> solution? Can I use sorting capabilities of apply-templates
> for that?

xsl:sort only affects the order in which nodes are processed; it doesn't
rearrange the source tree. It wouldn't be useful here.

I suspect your problem rests in the code you sent in private mail, in
which you applied the solution in a manner that resulted in every row
being processed, meaning the grouping was done (row) number of times.

   - Mike
Mike J. Brown, software engineer at            My XML/XSL resources: in Denver, Colorado, USA    

 XSL-List info and archive:

Current Thread