xsl-list
[Top] [All Lists]

RE: [xsl] How to sort a nodeset returned by key()?

2008-04-05 05:36:10

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(_at_)hotmail(_dot_)com] 
Sent: 05 April 2008 20:18
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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 Mengué.
http://o.mengue.free.fr/
_________________________________________________________________
Découvrez les profils Messenger de vos amis !
http://home.services.spaces.live.com/
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--