xsl-list
[Top] [All Lists]

[xsl] Grouping using distinct-values?

2008-07-03 12:53:56


Hi all,

Struggling with my understanding of grouping, in spite of the excellent 
examples in the FAQ and archives -- sorry for my thick-headedness.

Using xslt2 and saxon 9

XML is a terrible db dump:


    [SECTION NAME 9]
        10
        Common Property
        SERVICEURL_PRIMARY
        2
        https://x.y.z.net/sd
    
        
        [SECTION NAME 2]
        14
        some Property
        some name
        4
        some value
    
        
        [SECTION NAME 9]
        1
        random property
        another name
        4
        another value
       
    
       
    
        
    
    
   

I need to write name=value pairs (name being the  and value being the  for all 
groups of column elements (or is it groups of record elements??) in table 
name="tbl_nm" which share a like value for , sorted by the value of the column 
group's .

So, the expected result for the above xml would be something like:

[SECTION NAME 9]
SERVICEURL_PRIMARY=https://x.y.z.net/sd
another name=another value
[SECTION NAME 2]
some name=some value

My thinking has been that I'll write a for loop which will identify all the 
distinct property_section_nm that I have, and pass each of the distinct values 
in turn to a call-template which can then group across the xml doc, and, in a 
for loop of it's own, sort and then output the name=value pairs:


    
    
    
    
    
        $name
    



    
    
        
        
        
        
    



but I'm getting an error message that my context item:
"/database/table[(_at_)name='tbl_nm']/record[column[(_at_)name='property_section_nm'
 and .=$nm]]"
isn't a node.  I've evaluated that xpath, without the variable name, and it 
selects successfully...

Thanks for any hints

Edmund
_________________________________________________________________
Watch “Cause Effect,” a show about real people making a real difference.  Learn 
more.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause
--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Grouping using distinct-values?, edmund mitchell <=