AwanJohnie
Usenet Archive
- Joined
- Sep 21, 2004
- Messages
- 5
- Reaction score
- 0
I have an XML doc and successfully transformed into a table using XSL. The Challenge is how to sort the information by columns. I am writting diffrent XSL for the diffrent sorts (i.e per column) but I can't just get the basic one to work. I get no errors but the data is not sorted.
Please help.
1. To order by Title===@name
2. To Order by Author ===../attribute[@attid='5']
3. To order by Date === .../attribute[@attid='3']
XSL
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="live" />
</body>
</html>
</xsl:template>
<xsl:template match="live">
<table >
<tr >
<th>Title</th>
<th>Author</th>
<th>Date</th>
</tr>
<xsl:for-each select="llnode">
<xsl:sort select = "./@name" order="descending"/>
<xsl:apply-templates select="llnode" />
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="llnode">
<tr>
<td width="44%"> <A>
<xsl:attribute name="HREF">
http://www.whateverurl.org=<xsl:value-of
select="@id"/>&objAction=open </xsl:attribute>
<xsl:value-of select="@name"/> </A> </td>
<td ><xsl:value-of select="category/attributeset/attribute [@attid='5']"/></td>
<td>
<xsl:value-of select="substring-before(category/attributeset/attribute[@attid='3'],'T')"/></td> </tr> </xsl:template> </xsl:stylesheet>
Please help.
1. To order by Title===@name
2. To Order by Author ===../attribute[@attid='5']
3. To order by Date === .../attribute[@attid='3']
XSL
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="live" />
</body>
</html>
</xsl:template>
<xsl:template match="live">
<table >
<tr >
<th>Title</th>
<th>Author</th>
<th>Date</th>
</tr>
<xsl:for-each select="llnode">
<xsl:sort select = "./@name" order="descending"/>
<xsl:apply-templates select="llnode" />
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="llnode">
<tr>
<td width="44%"> <A>
<xsl:attribute name="HREF">
http://www.whateverurl.org=<xsl:value-of
select="@id"/>&objAction=open </xsl:attribute>
<xsl:value-of select="@name"/> </A> </td>
<td ><xsl:value-of select="category/attributeset/attribute [@attid='5']"/></td>
<td>
<xsl:value-of select="substring-before(category/attributeset/attribute[@attid='3'],'T')"/></td> </tr> </xsl:template> </xsl:stylesheet>