[xsl] Grouping using distinct-values?

Subject: [xsl] Grouping using distinct-values?
From: edmund mitchell <edmund_mitchell@xxxxxxxxxxx>
Date: Thu, 3 Jul 2008 09:53:30 -1000
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[@name='tbl_nm']/record[column[@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

Current Thread