xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krobe...@mmm.com
Subject test attribute null evaluation doesn't work
Date Tue, 06 May 2003 18:04:45 GMT
I'm sorry to bother you all over this; but I've tried several things and
can't get this to work in xalan-j 2.5.0. I am also fairly new to xslt.

This code evaluates to true when StartTime is not set. <xsl:when test
="$StartTime"> I want it to evaluate to false. It worked fine in xalan-1.

Here is a simple test stylesheet.

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0"
                xmlns:xalan="http://xml.apache.org/xalan"
                exclude-result-prefixes="xalan">

  <xsl:output method="xml" version="1.0" encoding="ISO-8859-1"/>
  <xsl:strip-space elements="*"/>

  <xsl:param name="TimeOption">AllTimes</xsl:param>
  <xsl:param name="TimeValues"/>

  <!-- variables used for setting up search criteria -->
  <xsl:variable name="StartTime">
    <xsl:if test="$TimeOption='SlidingTimes' or $TimeOption
='SpecificTimes'">
      <xsl:value-of select="substring-before($TimeValues, ';')"/>
    </xsl:if>
  </xsl:variable>
  <xsl:variable name="EndTime">
    <xsl:if test="$TimeOption='SlidingTimes' or $TimeOption
='SpecificTimes'">
      <xsl:value-of select="substring-after($TimeValues, ';')"/>
    </xsl:if>
  </xsl:variable>

  <!-- main template -->
  <xsl:template match="/">

    <xsl:message>**************$TimeOption****<xsl:value-of select
="$TimeOption"/>*****</xsl:message>
    <xsl:message>**************$StartTime****<xsl:value-of select
="$StartTime"/>*****</xsl:message>

  <queryVariables>
   <xsl:choose>

     <xsl:when test="$StartTime">
            <!-- Start Time -->
        <Item>
              <attribute ncid="4" />
            <value>
              <text>
                        <xsl:value-of select="$StartTime" />
              </text>
                  </value>
          </Item>

        <!-- End Time -->
        <Item>
          <attribute ncid="5" />
            <value>
              <text>
                        <xsl:value-of select="$EndTime" />
              </text>
            </value>
        </Item>
      </xsl:when>
    </xsl:choose>

   </queryVariables>

  </xsl:template>

</xsl:stylesheet>

Any assistance will be greatly appreciated.

Keith...


Mime
View raw message