[xsl] Sorting on an attribute passed as a parameter from JavaScript

Subject: [xsl] Sorting on an attribute passed as a parameter from JavaScript
From: "Grant, Kathryn --- Sr. Technical Writer --- WGO" <Kathryn.Grant@xxxxxxxxxxxxxxxxx>
Date: Tue, 3 Feb 2004 11:18:10 -0800
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


Current Thread