|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: value of xsl:param in xsl:sort
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








