[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to sort a nodeset returned by key()?
If you are using XSLT 1.0 then the type system only supports node-sets, not node-sequences, therefore you cannot store a sorted node-sequence in a variable. The approach you outline would be fine for XSLT 2.0, but in 1.0 you'll have to find some other way. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Dolmen ! [mailto:dolmen@xxxxxxxxxxx] > Sent: 05 April 2008 20:18 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: How to sort a nodeset returned by key()? > > > Hi, > > Short: > How can i sort a nodeset returned by key(), store it in a > variable, and still be able to compare its nodes with nodes > of the original document ? > > Long: > > This is a transformation of my data set to an HTML table > using rowspans. > I'm sorting my data, then I'm using a Muenchian grouping to > group rows. > > My problem is that the order of my sorted node set is not the > same as the order of the nodeset returned by key(). I have > not found how to reliably distinguish the first node of the > group to output the grouping cells in the right place. > > I'm using xsltproc (from libxslt) > > Here is an example using Steve Muench's data from > http://www.dpawson.co.uk/xsl/sect2/N7450.html#d11343e31 > > If I remove this sort, the XHTML, is clean, but the table is > not sorted. > > > > > > Johnosn's Laundry > Franks's Laundry > Mary's Laundry > Bill's Laundry > Hammond's Laundry > > > Franks's Diner > Johnosn's Diner > Hammond's Diner > Mary's Diner > Bill's Diner > > > > > > > > > > > > > > > Accounts ordered by region > > > RegionAccount > > > > > > > > > > > > > > > > > > > > Here is the broken HTML output : > > > > > > > > > Accounts ordered by region > > > > > Region > Account > > > Bill's Diner > > > Mary's Diner > > > Alaska > Mary's Laundry > > > Franks's Diner > > > Canada > Franks's Laundry > > > Hammond's Diner > > > Hammond's Laundry > > > Johnosn's Diner > > > Midwest > Johnosn's Laundry > > > New Jersey > Bill's Laundry > > > > > > > > > Olivier Mengui. > http://o.mengue.free.fr/ > _________________________________________________________________ > Dicouvrez les profils Messenger de vos amis ! > http://home.services.spaces.live.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|