Hello -
I need help sorting an xml file. I'd like to sort the xml based on the
value found in <colvalue> of the second <col>.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="sort.xsl"?>
<rows>
<row>
<col><colname>VIEW_ID</colname><colvalue><![CDATA[YZGOSDC63_Q002_V001_AV01]]></colvalue></col>
<col><colname>VIEW_SIZE</colname><colvalue><![CDATA[S]]></colvalue></col>
<col><colname>TITLE</colname><colvalue><![CDATA[Small:
Indicator]]></colvalue></col>
<col><colname>PARENT_RPT</colname><colvalue><![CDATA[YZGOSDC63_Q002]]></colvalue></col>
<col><colname>TEMPLATE_ID</colname><colvalue><![CDATA[ZGO_EART_WWW_TEMPLATE_001]]></colvalue></col>
</row>
<row>
<col><colname>VIEW_ID</colname><colvalue><![CDATA[YZGOSDC63_Q002_V002_AV01]]></colvalue></col>
<col><colname>VIEW_SIZE</colname><colvalue><![CDATA[A]]></colvalue></col>
<col><colname>TITLE</colname><colvalue><![CDATA[Small: Latest
Budget]]></colvalue></col>
<col><colname>PARENT_RPT</colname><colvalue><![CDATA[YZGOSDC63_Q002]]></colvalue></col>
<col><colname>TEMPLATE_ID</colname><colvalue><![CDATA[ZGO_EART_WWW_TEMPLATE_001]]></colvalue></col>
</row>
<row>
<col><colname>VIEW_ID</colname><colvalue><![CDATA[YZGOSDC63_Q002_V003_AV01]]></colvalue></col>
<col><colname>VIEW_SIZE</colname><colvalue><![CDATA[Z]]></colvalue></col>
<col><colname>TITLE</colname><colvalue><![CDATA[Small: Last
Year]]></colvalue></col>
<col><colname>PARENT_RPT</colname><colvalue><![CDATA[YZGOSDC63_Q002]]></colvalue></col>
<col><colname>TEMPLATE_ID</colname><colvalue><![CDATA[ZGO_EART_WWW_TEMPLATE_001]]></colvalue></col>
</row>
</rows>
Here's the XSL I'm using. I've had some luck with <xsl:sort> , but I
haven't gotten it to work the way I need it to.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="rows/row">
<tr>
<xsl:for-each select="col">
<td><xsl:value-of select="colvalue"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>