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

Re: [Accumulators] Another stupid question

Subject: Re: [Accumulators] Another stupid question
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 Oct 2020 07:45:42 -0000
Re:  [Accumulators] Another stupid question
Am 07.10.2020 um 00:50 schrieb Martin Honnen martin.honnen@xxxxxx:

Now I wonder whether nevertheless the sample shows that the accumulator
wrongly did not fire for the parentless element.

A shorter test case is

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="3.0">

   <xsl:accumulator name="a1" as="xs:string" initial-value="'init'">
       <xsl:accumulator-rule match="foo" select="$value || ', matched '
|| path()"/>

   <xsl:param name="p1">

   <xsl:param name="p2" as="element(foo)">

   <xsl:template name="xsl:initial-template">
       <xsl:apply-templates select="$p1/node(), $p2"/>

   <xsl:template match="foo">
       <foo-processed accumulator-value="{accumulator-before('a1')}"


when run with Saxon 10.2 HE with option -it it outputs

<?xml version="1.0" encoding="UTF-8"?><foo-processed
accumulator-value="init, matched /Q{}foo[1]" root=""/><foo-processed
accumulator-value="init" root="foo"/>

Shouldn't the rule for `foo` elements be applied as well to the
parentless `foo` and therefore it should have an accumulator-before
value different from the "init" initial value?

Saxon-JS 2 gives

<?xml version="1.0" encoding="UTF-8"?><foo-processed
accumulator-value="init, matched /Q{}foo[1]" root=""/><foo-processed
accumulator-value="init, matched /Q{}foo[1]" root="foo"/>

so there the parentless foo is matched by the accumulator (although I am not sure the value returned by "path()" is the right one for a parentless node).

Current Thread


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.
First Name
Last Name
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.