Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Revisiting elements through XSL

From: David Carricajo <david.carricajo@-----.--->
To: 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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent