xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krobe...@mmm.com
Subject RE: Conditional assignment of tree frag to variable doesn't work.
Date Fri, 09 May 2003 19:39:10 GMT
This what I had to do to get things to work with minimal changes to xalan-1
code.

    <xsl:variable name="SelectFilterX">
      <xsl:choose>
        <xsl:when test="$Filter=normalize-space($fieldTest)">
          <xsl:copy-of select="$OSHProfile/default_filter/filter"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:copy-of select="$OSHProfile/quick_filters/*[field[1]
=$Filter]"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="SelectFilter" select="xalan:nodeset
($SelectFilterX)"/>
    <xsl:copy-of select="$SelectFilter"/>

This outputs:

    <filter name="filter">

<field>
                Summary View
            </field>

<field>
                0
            </field>

<field>

</field>

</filter>

Yea, the structure is maintained in the assignment.
Now the tests below evaluate to true. I had to add /filter in the path.
Apparently the filter step was not selected in xalan-1.

    <xsl:if test="normalize-space($SelectFilter/filter/field[2]/text())
='0'">
        <xsl:text>Field 2 is 0.</xsl:text>
    </xsl:if>

    <xsl:if test="mmiFacilityCid/@ncid=normalize-space
($SelectFilter/filter/field[position()>2]/text())">
        <xsl:text>Field > 2 has ncid.</xsl:text>
    </xsl:if>


Mime
View raw message