Subject: Re: [xsl] value of xsl:param in xsl:sort From: Peter Davis <pdavis152@xxxxxxxxx> Date: Wed, 13 Feb 2002 21:22:21 -0800 |
I assume that your xsl:sort is a child of a xsl:for-each or an xsl:apply-templates, and that the xsl:param is a child of an xsl:template or the top level, and that the xsl:param and xsl:sort are not together like you pasted, or else your stylesheet shouldn't work at all. If that's not the case, then look at that first. The problem is that xsl:sort converts the result of its select attribute with the string() function and uses that as the sort key. So what you have is string($sortByElement), which is the same for every element since the value of $sortByElement never changes. Since all the sort keys are identical, the sort has no effect. Specifying the path directly would have a different result for each element in the sorted list. Unfortunately you can't use a param or variable like this, since its value never changes. If you need to use a complete XPath expression dynamically, look for an "evaluate" extension function for your specific processor. Otherwise, you are stuck with matching the name of a single child element, as someone else posted, by doing *[name() = $sortByElement]. On Wednesday 13 February 2002 20:41, Kunal H. Parikh wrote: > Hi ! > > ======================== > <xsl:param name="sortByElement">AuthorList/Author/Name</xsl:param> > <xsl:sort select="$sortByElement" order="ascending"></xsl:sort> > ======================== > > The above code does not seem to be replacing the $sortByElement for the > parameter. > > But, if I replace "$sortByElement" with "AuthorList/Author/Name", > everything works out just fine. > > Can someone please suggest what mistake I am making ? > > > > TIA, > > Kunal > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- Peter Davis It is very difficult to prophesy, especially when it pertains to the future. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] value of xsl:param in xsl, alex | Thread | Re: [xsl] value of xsl:param in xsl, Kunal H. Parikh |
Re: [xsl] value of xsl:param in xsl, alex | Date | Re: [xsl] value of xsl:param in xsl, Kunal H. Parikh |
Month |