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

Re: xml to xml transform

Subject: Re: xml to xml transform
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 16 Jan 2001 18:59:29 -0700 (MST)
xml to xml transform sort
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"?>
<f1>
   <v1/>
   <v2/>
   <v2/>
</f1>
<f2>
   <v3/>
</f2>
<f3>
   <v4/>
</f3>

> 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: 
webb.net in Denver, Colorado, USA              http://skew.org/xml/


 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.