xsl-list
[Top] [All Lists]

for-each sorting problem

2004-04-11 08:30:15
Hi,
   Can someone help me with this. I have the following
XML.
 
 <ROOT>
        <INFO>
                <ID_1>11124</ID_1>
                <ID_2>34154</ID_2>
                <ID_3>45787</ID_3>
                <ID_4>78454</ID_4>
                <ID_5>12457</ID_5>
                <ID_6>45988</ID_6>
                <ID_7>45124</ID_7>
                <ID_8>78436</ID_8>
                <ID_9>63254</ID_9>
                <ID_10>78436</ID_10>
                <ID_11>63254</ID_11>
                <NAME_3>Bbbb</NAME_3>
                <NAME_7>Ffff</NAME_7>
                <NAME_6>EEEE</NAME_6>
                <NAME_8>FFFF</NAME_8>
                <NAME_1>Aaaa</NAME_1>
                <NAME_4>Dddd</NAME_4>
                <NAME_9>Gggg</NAME_9>
                <NAME_5>Eeee</NAME_5>
                <NAME_10>GGG</NAME_10>
                <NAME_11>Hhh</NAME_11>
        </INFO>
</ROOT>


Now, in the stylesheet, I want to do a <xsl:for-each>
on every element that starts with 'ID_' but the output
should be sorted on the 'NAME_[x]' values. i.e., the
value of elements that starts-with 'NAME_'. This might
be pretty basic, but I am still new to xslt and can
someone help? I can't do a for-each on 'NAME_' and do
a sort on '.' because there might not be a NAME
element corresponding to the ID_[x] element (as in the
above XML there is no NAME_2) and I need to display a
row for each ID irrespective of the NAME_[x] element
being available or not.
 
Thanks
Sam.

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca


<Prev in Thread] Current Thread [Next in Thread>