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

Re: Problem sorting incoming node list

Subject: Re: Problem sorting incoming node list
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 May 2019 20:47:54 -0000
Re:  Problem sorting incoming node list
On 08.05.2019 19:18, Michael Kay mike@xxxxxxxxxxxx wrote:
I haven't had a chance to study all of this, but please note that if you
want to use the XPath 3.1 function then you should be using a more recent
Saxon release than 9.3. The current version is 9.9. Also, only the 1-argument
version of sort() will work in Saxon-HE; the more useful versions of the
function (that allow a user-defined sort key) are higher order functions and
therefore require Saxon-PE or Saxon-EE. The syntax would be

<xsl:for-each-group select=bsort(entry[location=$undulator],
function($entry) {data($entry/(isodate,time))})"
group-by="statistics_category">

To do it with HE you could implement a sort function with xsl:function
based on xsl:perform-sort e.g. declare some namespace for your function
xmlns:mf="http://example.com/mf" and define

<xsl:function name="mf:sort-entries" as="element(entry)*">
  <xsl:param name="entries" as="element(entry)*"/>
  <xsl:perform-sort select="$entries">
    <xsl:sort select="isodate"/>
    <xsl:sort select="time"/>
  </xsl:perform-sort>
</xsl:function>

then you can use

  <xsl:for-each-group
select="mf:sort-entries(entry[location=$undulator])" group-by="..."

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.