[Top] [All Lists]

[xsl] Are xsl:accumulator-rules exclusive ?

2020-09-21 16:52:07

I didn't manage to find the response in the specs, so...

Are xsl:accumulator-rule mutually exclusives, and do default priorities for template rules apply in accumulator-rule ? Is the same node able to fire many xsl:accumulator-rule in the same mode, if evaluated only once ?

For example, if I have this accumulator :

  <xsl:accumulator name="weight" as="xs:integer" initial-value="0">
    <xsl:accumulator-rule match="box[xs:integer(@width) gt 100][xs:integer(@height) gt 100]" select="$value + 100"/>     <xsl:accumulator-rule match="box[xs:integer(@width) gt 50][xs:integer(@height) gt 50]" select="$value + 50"/>
    <xsl:accumulator-rule match="box" select="$value + 1"/>
  <xsl:mode use-accumulators="#all" on-no-match="shallow-copy"/>

  <xsl:template name="xsl:initial-template">
    <xsl:variable name="content" as="element(box)*">
      <box width="150" height="150"/>
    <xsl:apply-templates select="$content"/>

I'd expect to get <box width="150" height="150">100</box> but I get <box width="150" height="150">1</box>.

Is it normal ?

Should I put a xsl:choose in the rule match="box" and evaluate all possibilities inside the choose ?

Best regards,
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>