xml - Sorting data and storing only top three results in variable: XSLT -
i have xml file say
<nodes> <node>12</node> <node>244</node> <node>234</node> <node>45</node> <node>7</node> <node>112</node> <node>64</node> <node>3</node> </nodes>
all want is, sort data according values in descending order, , store top 3 results in variable.
sorting of data has done using <xsl:sort>
, how store top 3 results in variable , how access varible?
i want display data top 3 projects. i.e.
value1=244 value2=234 value3=112
please ask more information required.
you can use position()
function:
<xsl:for-each select="nodes/node"> <xsl:sort select="."/> <xsl:if test="position() < 4"> ... value<xsl:value-of select="position() + 1"/>=<xsl:value-of select="."/> ... <xsl:if> </xsl:for-each>
Comments
Post a Comment