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

Changing sort order via a parameter

Subject: Changing sort order via a parameter
From: Danny Vint <dvint@xxxxxxxxxxxxxx>
Date: Wed, 04 Jun 2003 16:05:37 -0700
xsl sort order parameter
I have a situation where I need to change from a text ordering to number order depending upon a parameter. I know this value at the start of the process, so I don't have to determine that.

I've tried the following:

<xsl:for-each test="xxx">
	<xsl:sort select="zzz">
		<xsl:attribute name="data-type">
			<xsl:choose>
				<xsl:when test="$A='Life'">number</xsl:when>
				<xsl:when test="$A='P_C'">text</xsl:when>
			</xsl:choose>
		</xsl:attribute>
	</xsl:sort>
</xsl:for-each>

Doesn't work because I'm creating an attribute on the stylesheet element.

<xsl:for-each test="xxx">
	<xsl:sort select="zzz">
		<xsl:attribute name="data-type">
	<xsl:choose>
		<xsl:when test="$A='Life'">
			<xsl:sort select="zzz" data-type="number"?>
		</xsl:when>
		<xsl:when test="$A='P_C'">
			<xsl:sort select="zzz" data-type="text"?>
		</xsl:when>
	</xsl:choose>
</xsl:for-each>

This doesn't work because xsl:sort is not a child of xsl:template or xsl:for-each. Is there some other method I have missed? I would like to avoid duplicating the code just to control the sort order, and this means also putting the code into a named template.

..dan
---------------------------------------------------------------------------
Danny Vint
http://www.dvint.com






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.