xsl-list
[Top] [All Lists]

[xsl:sort] sort by text that correspond to code in xml

2003-01-17 04:10:33

Let's say i have a xml file like this:


<root>
...
...
<lunastusarvot>
  <lunastusarvo>
    <arvo_osalajikoodi>4410</arvo_osalajikoodi>
    <tunnus>12</tunnus>
    <nimi>ALLMÄN VÄG</nimi>
  </lunastusarvo>
  <lunastusarvo>
    <arvo_osalajikoodi>2300</arvo_osalajikoodi>
    <tunnus>5</tunnus>
    <nimi>ALLMÄN VÄG</nimi>
  </lunastusarvo>
  ..
  ..
<lunastusarvot>
...
...
</root>

and i would have to sort the by <arvo_osalajikoodi>. But not by the number
(4410,2300) rather by the text that the codes correspond to. The code is
changed to text by a template.

<xsl:for-each select="../lunastusarvo">
  <!-- this sorts by the code -->
  <xsl:sort select="lunastuslajikoodi" data-type="number" />
  <!-- and this doesn't work obviously -->
  <xsl:sort><xsl:apply-templates
    select="$lunastuslaji-koodisto"><xsl:with-param name="arvo" 
    select="lunastuslajikoodi"/></xsl:apply-templates></xsl:sort>
  ..
  ..
</xsl:for-each>


Regards,
  Matts Isuls

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • [xsl:sort] sort by text that correspond to code in xml, Matts Isuls <=