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

RE: Sorting in descending order on the sum of a calcul

Subject: RE: Sorting in descending order on the sum of a calculation
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 29 Nov 2001 09:16:41 -0000
descending order
> I am rather new to xml and this list... I am trying to convert a stats
> program I wrote into xml / xsl format and I am having trouble
> getting one of
> the xsl style sheets to work.  I need to sort the result of a
> sum performed
> on an xml attribute in descending order by the total sum
> retrieved.  I can
> sum all of the like fields in a table for display but I am
> having trouble
> getting it to then display in descending order.

Tackle this as a two phase transformation, phase one to do the summation and
phase two to do the sorting. Put  the intermediate results in a result tree
fragment, and process it for phase two using the xx:node-set() extension
function that comes with your chosen processor.

<xsl:variable name="phase1out">
  <xsl:apply-templates select="/" mode="phase1"/>
</xsl:variable>

<xsl:template match="/">
  <xsl:apply-templates select="xx:node-set($phase1out)" mode="phase2"/>
</xsl:template>

Mike Kay


 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.