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

RE: Sorting on an attribute passed as a parameter from

Subject: RE: Sorting on an attribute passed as a parameter from JavaScript
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 3 Feb 2004 20:11:53 -0000
xsl sort parameter
If you know that the name being passed in is an attribute, then you can
do

<xsl:sort select="@*[name()=$param1]"/>

If you don't know whether it's an element or an attribute then you've
got a problem because it's ambiguous, but you could try

<xsl:sort select="(*|@*)[name()=$param1]"/>

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Grant, Kathryn --- Sr. Technical Writer --- WGO
> Sent: 03 February 2004 19:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Sorting on an attribute passed as a parameter 
> from JavaScript
> 
> 
> I think this problem probably has a simple solution. I have a 
> web page with a JavaScript that passes a parameter to an XSL 
> file so a sort can be performed using the parameter. The sort 
> works with element names, but not with attribute names.
> 
> For example, given the following XML:
> 
>     <SCReg reg_num="04">EREG</SCReg>
> 
> when I pass "SCReg" to the XSL file as param1, the sort works 
> correctly. But when I pass "SCReg/@reg_num," the sort doesn't work. 
> 
> Here's the sort code from the XSL file:
> 
>     <xsl:sort select="*[name()=$param1]"/>
> 
> Apparently this code doesn't work with attributes. How can I 
> tweak it so it works with elements and attributes?
> 
> I should add that <xsl:sort select="SCReg/@reg_num"/> DOES work.
> 
> Thanks in advance!
> Kathryn
> 
> 
> **********************************************************
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> ****************************************************************
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.