[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Param in xsl:sort select
Hello I'm trying to pass a string value as a parameter to my stylesheet. That value is supposed to control the sorting of contacts. I have a solution that works but the expression used in my xsl:sort select attribute looks horrible (./*[local-name()=$sortParam]). I want to use something like <xsl:sort select="$sortName"/> instead but that doesn't work. Why? I have used MSXML4.0. Thanks in advance /Marcus Example XML: <contacts> <contact> <firstName>a first name</firstName> <lastName>a last name</lastName> ... </contact> ... ... </contacts> XSLT: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="sortParam">firstname</xsl:param> <xsl:template match="contacts"> <table cellspacing="0" cellpadding="0" border="1"> <tr><td>Name</td><td>Tele</td><td>Email</td><td>Homepage</td></tr> <xsl:apply-templates select="contact"> <xsl:sort select="./*[local-name()=$sortParam]"/> </xsl:apply-templates> </table> </xsl:template> ... </xsl:stylesheet> 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
|