xml editor

   XML Editor
   XML Author
      DITA Editor
      DocBook Editor
      TEI Editor
      XHTML Editor
      Schema Editor
      XML Schema Editor
      RelaxNG Editor
   XQuery
   SVN Client
      Office Open XML
      XSL:FO Editor
      SVG Editor
      WSDL Editor
Supported platforms
Compatible with Windows7 & Mac OS X Snow Leopard
Ready for
data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Sorting in descending order on the sum of a calculation


Subject: RE: [xsl] 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

> 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
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2009 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>® XML Editor