|
Subject: Re: [xsl] Passing sort criteria as a paramter From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 25 Jan 2002 10:25:16 +0000 |
Hi David,
> You seemed to get this msg to the list. Wendell, thanks. I didn't
> think of that. BTW, can I use an xsl:attribute tag for another xsl
> element?
Since Wendell nabbed the other question, I'll answer this one ;)
I take it you're asking whether you can use xsl:attribute to
dynamically create an attribute on an XSLT element. So you're asking
if you can do:
<xsl:sort>
<xsl:attribute name="select">
<xsl:value-of select="$sortby" />
</xsl:attribute>
</xsl:sort>
As a way of getting around the fact that $sortby is a string and you
want to interpret it as an XPath expression.
The answer is no, you can't. You can only use xsl:attribute to add
attributes onto result elements (whether created with literal result
elements or with xsl:element).
Of course if the 'xsl:sort' were a literal result element, then it
would be fine. So if you were generating a stylesheet from your
stylesheet, and set up a namespace alias for the XSLT namespace so
that 'oxsl' was the prefix used for the XSLT elements you're
generating, you can do:
<oxsl:sort>
<xsl:attribute name="select">
<xsl:value-of select="$sortby" />
</xsl:attribute>
</oxsl:sort>
and it will generate:
<oxsl:sort select="Amount[../IsCredit = 1]" />
By the way, I suggest that you forward your use case on to
xsl-editors@xxxxxx - hopefully if they receive enough use cases then
they will add an evaluate() function to XSLT 2.0, so that you could
just do:
<xsl:sort select="evaluate($sortby)" />
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Passing sort criteria as , David B. Bitton | Thread | [xsl] Arabic characters and FOP, Tanzila Mohammad |
| RE: [xsl] Weird namespaces problem, Julian Reschke | Date | [xsl] Choice of a XSL-Fo processor, GISBERT Aurélien (DS |
| Month |