I have the following xml
<Values>
<New>
<value>110</value>
<date>2009-10-15</date>
</New>
<Previous>
<value>100</value>
<date>2010-10-15</date>
</Previous>
<Previous>
<value>130</value>
<date>2008-10-15</date>
</Previous>
</Values>
I am using the following xsl
<xsl:variable name="mergedData">
<xsl:for-each select="//Values/New">
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:for-each select="//Values/Previous">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="msxsl:node-set($mergedData)">
<xsl:sort order="descending" select="substring(date,1,4)"/>
<xsl:sort order="descending" select="substring(date,6,2)"/>
<xsl:sort order="descending" select="substring(date,9,2)"/>
<xsl:if test="position()=1">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
And I get the following.
110 2009-10-15 100 2010-10-15 130 2008-10-15
It does no seems to sort by date and its giving me back a lump of code I need to be sorted by date and been able to manipulate data so I can put them in table rows.
Like this.
110 2009-10-15
100 2010-10-15
130 2008-10-15