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

xsl:sort not working within xsl:choose

Subject: xsl:sort not working within xsl:choose
From: "Hardy Merrill" <HMerrill@xxxxxxxxxxxxxxxx>
Date: Fri, 10 Dec 2004 08:54:32 -0500
msxml4.dll error 80004005
MSXML4

I'm passing a script parameter into the xsl style sheet that tells me
what the sort field should be:

<xsl:param name="select_sort_field"/>

and then, within my for-each loop, I have the code to decide what to
sort by:

<xsl:for-each select="codes/value[code_type = $code_type]">
	
	<xsl:choose>
	<xsl:when test="$select_sort_field">
		<xsl:sort select="*[name()=$select_sort_field]" />
	</xsl:when>
	<xsl:otherwise>
		<xsl:sort select="code" />
	</xsl:otherwise>
	</xsl:choose>
	
<!--	<xsl:sort select="code" /> -->
<!--	<xsl:sort select="*[name()=$select_sort_field]" /> -->

-----------------------------------

but that's not working - I keep getting this error:

msxml4.dll error '80004005' 

Keyword xsl:sort may not be used here.

------------------------------------

What am I doing wrong?  The thing is, if I take out the entire choose,
and just use

   <xsl:sort select="code" />

or

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

it seems to work.  The thing is, I wanted to make it bullet proof in
case the script invoking this style sheet doesn't pass in the
$select_sort_field parameter - if not passed in, I want it to sort by
"code".

TIA.

Hardy Merrill.

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.