[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing sort criteria as a paramter

Subject: Re: Passing sort criteria as a paramter
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 24 Jan 2002 16:56:43 -0500
Re:  Passing sort criteria as a paramter

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:

<xsl:sort select="*[local-name() = $sortby"]">

and this works great.  Now, I want to qualify the element name, such
that the select attribute would read


if I wanted to just park the select attribute at one element.

Now, how can I pass the above predicated element name into the

If you just mean to apply the predicate to a dynamic element name, you would use the same idiom:


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.


====================================================================== 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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.