|
Subject: Re: [xsl] [Accumulators] Another stupid question From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 6 Oct 2020 22:50:39 -0000 |
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.
Saxon evaluates unstreamed accumulators lazily: the first time you evaluate accumulator-before, or accumulator-after, on any node in a particular document, the accumulator values are computed for all nodes in that document.
Now I wonder whether nevertheless the sample shows that the accumulator wrongly did not fire for the parentless element.
<?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: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><?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?
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] [Accumulators] Another st, Michael Kay mike@xxx | Thread | Re: [xsl] [Accumulators] Another st, Martin Honnen martin |
| Re: [xsl] [Accumulators] Another st, Michael Kay mike@xxx | Date | Re: [xsl] [Accumulators] Another st, Christophe Marchand |
| Month |