Subject: Re: passing a parameter to select attribute of <xsl:sort> From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 21 Jun 2000 19:34:50 +0100 |
Ryan and Nick, Well, you could try the old hack: <xsl:apply-templates select="./listItem"> <xsl:sort order="{$order}" select="*[local-name()=$orderingElement]"/> </xsl:apply-templates> Nick's explanation is essentially correct (except the select attribute doesn't take a pattern, it takes a string evaluated as an expression, not quite the same thing). This solution (warning:untested) would get around it by constructing such an expression that tests element names, as strings, against the variable (rather than assuming the variable can be used to select a node set relative to the context node, which it can't). Hope this helps, Wendell At 10:06 PM 6/21/00 +0100, you wrote: >Ryan, as I understand from the XSLT spec and Mike Kays book (p 119) you cannot do all >that you want to in one go. The select attribute cannot use an attribute value template >though the order attribute can. The reason being that select requires an XPath pattern. >I guess the way round this is with a choose/when/when/.../otherwise construct with each >of the possible sort conditions explicitly stated. > >Or is there another way ? > >Regards > >Nick Browne >Slipstone Ltd > > >Ryan Daigle wrote: > >> I am trying to pass a parameter into a sort element through another >> template as follows: >> ... >> <xsl:apply-templates select="./listItem"> >> <xsl:sort order="{$order}" select="$orderingElement"/> >> </xsl:apply-templates> >> </xsl:template> ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: passing a parameter to select a, Nick Browne | Thread | RE: passing a parameter to select a, Ryan Daigle |
Re: xsl:key, Jeni Tennison | Date | Re: Saxon Frustrations, Paul_Dick |
Month |