I need to sort my tags in a XML file based on multiple different nodes. For example: Consider the following XML:
<root>
<a>
<b>12</b>
<e>hello</e>
</a>
<a>
<b>11</b>
<e>how</e>
</a>
<a>
<c>13</c>
<f>are</f>
</a>
<a>
<b>21</b>
<f>you</f>
</a>
<a>
<d>22</d>
<e>hello</e>
</a>
<a>
<c>14</c>
<f>hi</f>
</a>
</root>
Now I need to find the maximum number from inside all the nodes inside a
.
I tried doing this:
<xsl:template match="root">
<xsl:for-each select="a">
<xsl:sort select="b | c | d" data-type="number" order="descending"/> <!-- this gives me error-->
<xsl:if test="position() = 1">
<!-- how to access my node -->
</xsl:if>
</xsl:for-each>
</xsl:template>
How can I do my sorting and get the value form the first node after sorting?
Thnx in advance!!
Note: I am using XSLT 1.0.