Sort XML

T

thomas

Is there anyway to sort an xml file either using asp or xsl BEFORE the
results are output by an xsl file, the way it works at the moment produces
some undesired results.

I use the below code to output 20 results per page but it only sorts the
first 20 results in the file then it sorts the next 20 results on the next
page.

<xsl:for-each select="cat/links[position() &gt;= $startPos and position()
&lt;= $endPos]">
<xsl:sort select="artist"/>
<code to output table>
</xsl:for-each>

In theory I would like the code to work like this but I get an error

<xsl:sort select="artist"/>
<xsl:for-each select="cat/links[position() &gt;= $startPos and position()
&lt;= $endPos]">
<code to output table>
</xsl:for-each>

Any Ideas?
 
B

bernwardhanssen

Hi thomas

try

<xsl:for-each select="cat/links">
<xsl:sort select="links"/>
<xsl:if test="position() &gt; 2 and position() &lt;= 5">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>

Bernward
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,743
Latest member
WoodrowMea

Latest Threads

Top