xsl-list
[Top] [All Lists]

XSL Decending Order Query

2002-11-03 05:29:17
My query is that of a basic one, but with trying to many times, i have failed in getting my xml data churned out in descending order, rather than ascending, which is the de facto standard.

My XML structure is as follows:

<archive>
        <news>
                <date>          </date>
                <article>       </article>
                <author>        </author>
        </news>
</archive>

The XSL i use as follows:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">
  <html>
  <body>
    <xsl:for-each select="archive/news">
    <xsl:sort select="archive/news" order="descending">
    <table width="100%" border="0">
        <tr>
        <td class="yell" align="left"><xsl:value-of select="date"/></td>
        <tr>
                <td align="center"><xsl:value-of select="article"/></td>
        </tr>
<tr><td class="yell" align="right"><xsl:value-of select="author"/></td></tr>
      </tr>
      <tr />
      <tr />
      <tr />
      <tr />
      <tr />
      <tr />
      <tr />
    </table>
    </xsl:sort>
    </xsl:for-each>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

It simply doesnt work, i have tried changing the nodes, and also have tried changing where to put the sort, i understand it has to be within the for-each.

if anyone can provide a solution to this problem, much appreciated


thanks in advance

Gill.


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



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