[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [Accumulators] Another stupid question
On 07.10.2020 00:33, Michael Kay mike@xxxxxxxxxxxx wrote:
Your private:block element is matched by a different "accumulator instance" from the one that matches the page element; an accumulator instance corresponds to one document, and accumulator instances for different documents don't interact. Otherwise, there would be a terrible dependency on order of processing.
A shorter test case is
<xsl:accumulator name="a1" as="xs:string" initial-value="'init'"> <xsl:accumulator-rule match="foo" select="$value || ', matched ' || path()"/> </xsl:accumulator> <xsl:param name="p1"> <foo/> </xsl:param> <xsl:param name="p2" as="element(foo)"> <foo/> </xsl:param> <xsl:template name="xsl:initial-template"> <xsl:apply-templates select="$p1/node(), $p2"/> </xsl:template> <xsl:template match="foo"> <foo-processed accumulator-value="{accumulator-before('a1')}" root="{node-name(root())}"/> </xsl:template> </xsl:stylesheet> 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?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|