4

Is there any way not to leave <choose> after first <when> match but continue check else conditions?

Alexander Zhugastrov
  • 12,678
  • 2
  • 20
  • 22

1 Answers1

16

I believe it's a no. As the spec says:

The content of the first, and only the first, xsl:when element whose test is true is instantiated. If no xsl:when is true, the content of the xsl:otherwise element is instantiated. If no xsl:when element is true, and no xsl:otherwise element is present, nothing is created.

from: http://www.w3.org/TR/xslt#section-Conditional-Processing-with-xsl:choose

you can't make it fall through other conditions like that. just convert it into a set of <xsl:if> following one another if you need a fall through

UPDATE. Here's a quote from the O'Reilly's XSLT book ( http://docstore.mik.ua/orelly/xml/xslt/ch04_02.htm ):

The C, C++, and Java switch statement is roughly equivalent to the element. The one exception is that procedural languages tend to use fallthrough processing. In other words, if a branch of the switch statement evaluates to true, the runtime executes everything until it encounters a break statement, even if some of that code is part of other branches. The element doesn't work that way. If a given evaluates to true, only the statements inside that are evaluated

Wernsey
  • 5,411
  • 22
  • 38
Pavel Veller
  • 6,085
  • 1
  • 26
  • 24