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

sorting and parameters

Subject: sorting and parameters
From: Perry Roland <pdr4h@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2000 09:04:25 -0500
sortorder parameter
I'm greatly appreciative of the help I've received from the list.  I
think I'm learning a lot, but I've run up against another stumbling
block: How do I pass a sort key to a stylesheet?

Here's my XML --


I want to be able to sort by title or by num using the same stylesheet.

Here's my stylesheet --

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="key">title</xsl:param>
<xsl:param name="sortorder">ascending</xsl:param>

<xsl:template match="/">
<BODY BGCOLOR="#ffffff">
<xsl:apply-templates select="hitlist"/>

<xsl:template match="list">
                <xsl:apply-templates select="item">
                        <xsl:sort select="{$key}" order="{$sortorder}"/>

<xsl:template match="item">
		<xsl:value-of select="title"/><BR/>
		<xsl:value-of select="num"/>


Using Saxon, I get the error "Invalid character ({) in expression {$key}".
I think the syntax is right because I have no problem with the sortorder
parameter.  I suspect the difference may be because the sortorder
parameter is a string while the key parameter is a collection of nodes,
but I don't know how to proceed from there.  Any help would be greatly


 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.