Search code examples
xsltxslt-2.0xslt-grouping

Testing for 2 conditions under group-starting-with in <xsl:for-each-group>


I need to test for 1 of 2 possible tags in a for-each-group. Is this possible? What is the correct syntax?

I tried "||" but got an error from the parser. I'm using Saxon PE 9.3 in Oxygen 12.1.

Ex.

<xsl:param name="elements" as="element()*"/>    
<xsl:for-each-group select="$elements"
                group-starting-with="condition or condition" >
    <xsl:for-each-group>

Solution

  • If you're wanting to group starting with either of two element names, try

    <xsl:for-each-group select="$elements"
                group-starting-with="foo | bar">