Helpful Information
 
 
Category: Programming Languages More
ASP - addparameter to XSL

Why wont this work!!??? I am not getting an error, but it simply wont sort by the parameter I pass from the asp page. If I dont pass a parameter, and sort by a non-variable, it sorts fine.

in my asp page:
objProc.addParameter "orderBy", "owner"

in my xsl page:
....stuff here
<xsl:param name="orderBy" select="owner"/>
....stuff here
<xsl:for-each select='/plcDocs/plc'>
<xsl:sort select="$orderBy"/>
<tr bgcolor="#999966">
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="path"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</td>
<td colspan="2">
<xsl:value-of select="owner"/>
</td>
<td colspan="2">
<xsl:value-of select="status"/>
</td>
<td colspan="2">
<xsl:value-of select="revDue"/>
</td>
</tr>
</xsl:for-each>
....stuff here

again, everything works fine if i dont try to pass the parameter. so, if my xsl sort tag is simply:
<xsl:sort select="owner"/>
then it sorts by the 'owner' node.

Any ideas? I'm stumped.
Thanks a ton
-Mac

Mac,

Think you need some extra (single) quotes round the select attribute; try this:

<xsl:param name="orderBy" select="'owner'" />

Grimmy

I don't know much about asp but I think It's not working because the xsl engine expects a value, not to perform an evaluation. You can deal with it doing:

<xsl:sort select="*[name()=$orderBy]"/>

By,
Lorenzo