I found what appears to be a bug that occurs sometimes when an xsl:iterate instruction has a parameter initialized with an empty value.

For example, using the source file

<a>
<session assignment="A"/>
<session assignment="B"/>
</a>

and the transformation

    <xsl:template match="/">
       <xsl:iterate select=".//session">
          <xsl:param name="assignment" as="xs:string?"/>
          <xsl:choose>
             <xsl:when test="not(@assignment eq $assignment)">
                   Inside new assignment loop
                <xsl:next-iteration>
                   <xsl:with-param name="assignment" select="@assignment"/>
                </xsl:next-iteration>
             </xsl:when>
             <xsl:otherwise/>
          </xsl:choose>
       </xsl:iterate>
       
    </xsl:template>

The expected behavior is that the first branch is triggered twice because the logical test "not(@assignment eq $assignment)" will be true for the first <session> element since $assignment is empty and the it will be true for the second <session> element because $assignment = 'A' but @assignment = 'B" .

The actual behavior is that this branch never fires.

If one puts something like "<xsl:value-of select="boolean(not(@assignment eq $assignment))"/> before the <choose> statement, the correct answer (true) is given.

If $assignment is initialized as the empty string with
<xsl:param name="assignment" select="''" as="xs:string?"'>, the expected output is generated.

-David



--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.