You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/03/19 11:19:01 UTC
[Bug 1020] New - xpath boolean treats strings wrong: strings with length 0 are not considered to be false.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1020
*** shadow/1020 Mon Mar 19 02:19:01 2001
--- shadow/1020.tmp.3689 Mon Mar 19 02:19:01 2001
***************
*** 0 ****
--- 1,61 ----
+ +============================================================================+
+ | xpath boolean treats strings wrong: strings with length 0 are not consider |
+ +----------------------------------------------------------------------------+
+ | Bug #: 1020 Product: XalanJ2 |
+ | Status: NEW Version: 2.0.0 |
+ | Resolution: Platform: PC |
+ | Severity: Critical OS/Version: Linux |
+ | Priority: Component: org.apache.xpath |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xalan-dev@xml.apache.org |
+ | Reported By: jtl@schlund.de |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ Strings with length 0 should be considered false in boolean test cases.
+ Xalan2 doesn't do so. Version of xalan is 20010319051516.
+
+ *** Th XML File:
+
+ <?xml version="1.0" encoding="ISO-8859-1"?>
+ <source>
+ <test foo="a1" bar="b1"/>
+ <test foo="a2" />
+ <test bar="b3"/>
+ </source>
+
+ *** The XSL File:
+
+ <?xml version="1.0" encoding="ISO-8859-1"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="test">
+ <xsl:param name="foo" select="@foo"/>
+ <xsl:param name="bar"><xsl:value-of select="@bar"/></xsl:param>
+ <xsl:choose>
+ <xsl:when test="$foo">*** FOO='<xsl:value-of select="$foo"/>'</xsl:when>
+ <xsl:otherwise>*** FOO is not set.</xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$bar">*** BAR='<xsl:value-of select="$bar"/>'</xsl:when>
+ <xsl:otherwise>*** BAR is not set.</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ </xsl:stylesheet>
+
+ *** The output produced (omitting some empty lines)
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ *** FOO='a1'
+ *** BAR='b1'
+
+ *** FOO='a2'
+ *** BAR=''
+
+ *** FOO is not set.
+ *** BAR='b3'
+
+ *** Note the BAR value in the second block.