Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Revisiting elements through XSL [Thread Next] Re: Revisiting elements through XSLTo: NULL Date: 12/5/2007 2:13:00 AM On 28 nov, 13:48, Martin Honnen <mahotr...@yahoo.de> wrote:
> David Carricajo wrote:
> > I had a xml which looked like:
Thanks Martin.
I put the xml by heart but i'm finding the hard way that xsl is a full-
fledged programmig language in its own. Your code works smoothly but i
failed to apply it to my code. My problem lies in sorting a xml tree
which looks like:
<root>
<A>
<B>
<IDENT id="escatron"/>
<POS>
<C1 v="1">
</C1>
<C2 En="21.3">
</C2>
</POS>
<POS>
<C1 v="2">
</C1>
<C2 En="17.8">
</C2>
</POS>
</B>
<B>
<IDENT id="supelec"/>
<POS>
<C1 v="1">
</C1>
<C2 En="1.1">
</C2>
</POS>
<POS>
<C1 v="3">
</C1>
<C2 En="3.5">
</C2>
</POS>
</B>
</A>
</root>
But i can't find the right sort based on the key par attributes
(C1::v, IDENT::id) attributes , in other words, i'd like the tree
ordered so that it can be rendered like:
1;escatron;21.3;
1;supelec;1.1;
2;escatron;17.8;
3;supelec;3.5;
I think i should order when i'm in the A context since B context looks
too late for such task. But if try:
<xsl:template match="A">
<xsl:apply templates>
<xsl:sort select="number(/B/POS/C1/@v)" order="descending" data-
type="number"/>
</xsl:apply templates>
</xsl:template match='A'>
the result in plain text looks rather like:
1;escatron;21.3;
2;escatron;17.8;
1;supelec;1.1;
3;supelec;3.5;
Any hint is appreciated.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
