I'm using Saxon 9.0.0.3. The following is extracted from a much larger transform:

 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:e="http://www.troux.com/temp"

    xmlns:xs="http://www.w3.org/2001/XMLSchema"

    version="2.0">

    <xsl:output method="xml" indent="yes"/>

   

    <xsl:function name="e:getPhase" as="xs:string">

        <xsl:text>Mixed Life Cycle</xsl:text>

    </xsl:function>

   

    <xsl:template match="/">

       

        <xsl:variable name="phaseMap">

            <item phase="Planning"                   section="partTwo"/>

            <item phase="Full-Acquisition"           section="partTwo"/>

            <item phase="Operations and Maintenance" section="partThree"/>

            <item phase="Mixed Life Cycle"           section="partTwo"/>

            <item phase="Multi-Agency Collaboration" section="partFour"/>

        </xsl:variable>

       

        <out>

            <xsl:variable name="phase" select="e:getPhase()"/>

            <xsl:variable name="part" select="$phaseMap/item[@phase=$phase]/@section"/>

            <example><xsl:value-of select="$part"/></example>

        </out>

    </xsl:template>

   

</xsl:stylesheet>

 

This small example produces the desired effect (the <example> tag text is "partTwo"), and Oxygen/XML’s debugger shows the correct variable values for $phase and $part.

 

When this construct is embedded in a much larger stylesheet, $part evaluates to an undefined value and produces incorrect output (the <example> tag text is empty).

 

If I replace the select expression in the definition of $part with

 

      $phaseMap/*[@phase=$phase]/@section

 

it starts working, and the Oxygen/XML debugger shows the expected values.

 

I've been unable to reproduce this in a simple example.  Apart from the size of the stylesheet, the only major difference between this example and the real thing is the function e:getPhase(), which does a lot more work in the full transform.  However, I have confirmed that $phase always has the expected value in both the full transform and the simple example above. The problem appears to be in the evaluation of the variable definition for $part.

 

At this point I don’t know if this is a bug in Saxon or a problem in Oxygen/XML, but I’m asking here in case it’s a known problem.