tags:

views:

24

answers:

2

Hi,

in xsl what code do you type to make the data in ascending or descending order?

I'm making an xml document for music that shows the title, genre and price. I wanted to show the data in ascending order by price.

How can I do it? I don't have a clue

Just so yo know the data is in a table

+1  A: 

use xsl:sort when selecting the input data.

<xsl:for-each select="album">
  <xsl:sort select="price" order="ascending"/>
  <tr>
    <td><xsl:value-of select="title"/></td>
    <td><xsl:value-of select="artist"/></td>
  </tr>
</xsl:for-each>
dkackman
A: 

You use xsl:sort inside xsl:apply-templates or xsl:for-each.

Pavel Minaev