Sorting a list

I’m trying to sort a list but i’m having problems.

I have a XSLT file that creates a table…this is its code:





<xsl:call-template name=“get_position”>
<xsl:with-param name=“param1” select=“$param1”/>
</xsl:call-template>



So, I have another XSLT file that has the template “get_position” and this is its code:

<xsl:template name=“get_position”>
<xsl:param name=“param1”/>
<xsl:for-each select=“/test/[ParamID=$param1]/positions”>


<xsl:value-of select=“($param1)/@position”/>


</xsl:for-each>
</xsl:template>

What I have to do to sort the values depending of the position…??

Thanks!

Hello there,

You can sort members of an iteration using xsl:sort tag.

eg :

<xsl:for-each select=“/test/[ParamID=$param1]/positions”>
<xsl:sort select=“.” type=“number” />



</xsl:for-each>

However, it seems that you want to sort data of the parameter ($param1), but you don’t iterate over $param1.

You might need to refactor your XSL in order to perform a sort.

Cheers.

Bertrand Martel
Software AG France

Hi

Do you have a small sample input file?

Cheers
Uli

Hi!

Ok, maybe I did not put the correct code, so what I wanted to explain was that how can I sort the list of values if these values were created in the other file.

So, I need an example of how to sort a list using xls:call-template ???

Thanks again!

Hi!

Thanks for everybody, I could fix my problem, I could sort my list…!!!