Click to See Complete Forum and Search --> : How to use variables for XSL attributes?


amiry
November 23rd, 2003, 10:16 AM
I'm looking for a way to use an XSL command with attributes values taken from a variable,
for example: (it doesn't work)

<xsl:sort select="$mypath" order="$sortorder" />

when I have a predefined xsl:variable named 'sortorder'
with appropriate value ('ascending' or 'descending'),
and another one named 'mypath'.

Is there a way to do it right?
xsl:attribute doesn't work for xsl commands.
Also, I don't want to use xsl:choose, because it's going to be a long list of xsl:when, considering all possible options for several attributes (in this case: 'order' and 'select').

Any suggestion?
Thanks!
-- Amir

professorX
November 24th, 2003, 02:15 AM
<xsl:sort select="$mypath" order="$sortorder" />

it's not right...
Try so:

<xsl:sort select="{$mypath}" order="{$sortorder}" />