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

Re: Techniques for Sorting and Reducing Maps in XSLT

Subject: Re: Techniques for Sorting and Reducing Maps in XSLT 3/XPath 3?
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Jul 2018 21:33:55 -0000
Re:  Techniques for Sorting and Reducing Maps in XSLT
here's a map free  xslt 2 version for comparison


$ saxon9 -it:main zz.xsl
### C
processing  file:/C:/tmp/ek1/A/B/C/en/1.2/foo.xml
processing  file:/C:/tmp/ek1/A/B/C/fr/1.3/foo.xml
### D
processing  file:/C:/tmp/ek1/A/B/D/en/1.4/foo.xml
processing  file:/C:/tmp/ek1/A/B/D/fr/1.3/foo.xml




<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


 <xsl:template name="main">
  <xsl:for-each-group select="collection('./A?select=foo.xml;recurse=yes')"
              group-by="replace(base-uri(.),'.*/A/B/([A-Z]+)/.*','$1')">
   <xsl:sort select="base-uri(.)"/>
   <xsl:message select="'###',current-grouping-key()"/>
   <xsl:for-each-group select="current-group()"
               group-by="replace(base-uri(.),'.*/A/B/[A-Z]+/([a-z]+)/.*','$1')">
    <xsl:apply-templates select="current-group()[last()]"/>
   </xsl:for-each-group>
  </xsl:for-each-group>
 </xsl:template>

 <xsl:template match="/">
  <xsl:message select="'processing ', base-uri()"/>
 </xsl:template>

</xsl:stylesheet>

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.