xsl-list
[Top] [All Lists]

Re: [xsl] Techniques for Sorting and Reducing Maps in XSLT 3/XPath 3?

2018-07-05 16:34:00
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>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>