[Top] [All Lists]

[xsl] xsl:accumulator and temporary trees

2020-02-12 08:01:27

I use an accumulator to calculate height of block elements in a page.

My accumulator is defined like this :

  <xsl:accumulator name="height.counter" as="xs:double" initial-value="0.0">
    <xsl:accumulator-rule match="page" select="2.3"/>
    <xsl:accumulator-rule match="li1" select="$value + 1.9" phase="end"/>
    <xsl:accumulator-rule match="li2" select="$value + 1.8" phase="end"/>
    <xsl:accumulator-rule match="li3" select="$value + 1.34" phase="end"/>
    <xsl:accumulator-rule match="private:block" select="$value + xs:double(./@height)" phase="end"/>

Modes are defined like this :

  <xsl:mode name="private:acc" on-no-match="shallow-skip" use-accumulators="#all"/>
  <xsl:mode use-accumulators="#all"/>

For a special element, I calculate the block height, and I proceed like this :

    <xsl:variable name="block" as="element(private:block)">
      <private:block height="{$height}"/>
    <xsl:apply-templates mode="private:acc" select="$block"/>

li1, li2 and li3, which are in source tree and processed in default mode do modify accumulator value. But my accumulator is never incremented when a private:block is processed.

Any suggestion will be much appreciated.

Best, and see you at Prague,
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>