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

Re: Strange Sorting Problem

Subject: Re: Strange Sorting Problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 3 Dec 2003 14:58:30 GMT
xsl sort descendant
a refugee from xml-dev:-)

  will append the xml and xslt inline. sorry for the bucket load of code
  but thought it best! ;)

er well complete input and output is always good, but i think you could
easily have deleted 90% of the stylesheet for the purposes of
demonstrating the problem.

as explained on xml-dev

 <xsl:sort select='$sorted_field'

is a constant sort key so does not sort anything, you would want

 <xsl:sort select='*[name()=$sorted_field'

but.. you say

> but whilst the variable i am using to implement the sort is populated 

I'm not sure what you mean by populated, but it's out of scope, the
scope of a variable or parameter is the element containing the variable
declaration.

In your case it is clearthat this template has no declaration for a
variable called sorted_field'
      <xsl:template name="workitem">
            <xsl:for-each select="descendant::*">

                  <xsl:sort select='$sorted_field'

You have

 <xsl:with-param name="sorted_field"

but you also need to declare the parameter of the template in the
template itself (unless it is a global param)

so  <xsl:template name="workitem">
     <xsl:param name="sorted_field"/>
            <xsl:for-each select="descendant::*">


I am not sure what you want to do here but you are selecting all the
descendent elements of workitem, but in your sample, all te hworkitem
elements had no descendent elements, they all just had a single text
node child containing a number, so you ares orting an empty list.



other unrelated things

  <img src='..\Images\asc.gif'>

is not a URI, URIs always use / not \

 <nobr>
is not html (not that XSLT cares whether the html you generate is valid
or not)

David



-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Strange Sorting Problem
    • CBeach - Wed, 3 Dec 2003 09:22:01 -0500 (EST)
      • David Carlisle - Wed, 3 Dec 2003 09:59:28 -0500 (EST) <=
      • <Possible follow-ups>
      • CBeach - Wed, 3 Dec 2003 10:28:21 -0500 (EST)

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.