[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Passing sort criteria as a paramter
David,
I can't claim to be Jeni (well I could but no one would be fooled), but At 04:33 PM 1/24/02, you wrote: I have been passing the sort element name into my xsl by way of a parameter. I then do this: If you just mean to apply the predicate to a dynamic element name, you would use the same idiom: select="*[local-name()=$sortby][../IsCredit=1]" This translates into English as "sort by the values of the element children whose name equals $sortby and whose parents have a child 'IsCredit' element whose value equals 1" But if you need to pass the whole thing in, as in passing in the string "Amount[../IsCredit=1]", you're stuck, unless the pattern is regular enough to break it down into pieces and use the same value-testing trick (sometimes testing the value of the name) on each piece separately. But your example leads me to think that's unlikely to cover your case. Unfortunately you can't pass an XPath expression in as a parameter and expect it to be evaluated: if it's a string, it's a string, not an XPath expression. If the name testing workaround isn't enough, some processors have extension functions for this; or if you're really stuck an expression can be parameterized by having a stylesheet generate your stylesheet. Enjoy, Wendell
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
|