|
Subject: Re: [xsl] cannot assign val to sort key From: Joerg Pietschmann <joerg.pietschmann@xxxxxx> Date: Sat, 09 Feb 2002 16:53:41 +0100 |
alex <shortestpath@xxxxxxxxx> wrote:
> From an asp page I pass values for sort key and sort
> order. [...] But I can't seem to assign assign the values
> of these variables to my <xsl:sort>. Here's what I'm
> doing:
>
> <xsl:sort select="$sortKey" order="{$sortOrder}" />
You expect the processor to evaluate the sort key expression twice,
which doesn't happen. The processor evaluates $sortKey and gets
whatever you assigned the variable, it wont evaluate this again
just because it looks like the selection expression you want
it to have used.
To work around this, if you have only simple element names there,
you can use select="*[name()=$sortKey]". This is a FAQ BTW, check
the archives. You probably also want to check the documentation
of your processor whether and how an evaluate() function is
supported.
Your sort order should work fine, you just didn't notice because
with your code all elements get the same sort key and therefore
always stay in document order.
HTH
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] cannot assign val to sort, Thomas B. Passin | Thread | [xsl] Proper xsl coding for ?, Brad Cox |
| Re: [xsl] problem with keeps in xsl, Joerg Pietschmann | Date | [xsl] CDATA, ronen levi |
| Month |