pc:switch |
Executes different actions depending on the value of a variable. Returns a text string or an XML fragment. Syntax
The required select attribute could be any XPath expression, but is typically a variable reference to the variable that you want to test the value of. Each of the pc:case child elements has a required value attribute. If the value of pc:switch's select attribute matches the value of this attribute, then the element's child content is executed. If there are multiple matches, they are all executed, in the document order in which the matching pc:case elements appear. If the optional pc:default element is present, its content is executed if none of the pc:each elements has a matching value. This happens regardless of whether pc:case elements occur before or after the pc:default element, or both. Example
The outcome is as follows:
See also |