xsl-list
[Top] [All Lists]

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

2008-04-05 05:18:27

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>
--~--