[ 
https://issues.apache.org/jira/browse/XALANJ-2379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489422
 ] 

David Marston commented on XALANJ-2379:
---------------------------------------

I believe that the current behavior is correct. The element
<param></param>
with no characters between the start and end tags, has no children.
A test like count(text()) would return zero. This is a more accurate view of 
the situation than
string-length(text()) returning zero, because the string-length behavior when 
given an empty node-set depends on the XPath spec defining that behavior as an 
exception. By contrast, the count() function is intended to report the number 
of members of a node-set.

As for the compare between an empty node-set and a null string, see part 3.4 of 
the XPath 1.0 spec, in particular the 5th paragraph. The complaint is about 
comparing a node-set, text(), to a string, ''. But there is no node in the 
node-set that has that string value because there is no node in the node-set. 
In other words, when one comparand is an empty node-set, the result is always 
false.

> Empty node text comparisons failing
> -----------------------------------
>
>                 Key: XALANJ-2379
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2379
>             Project: XalanJ2
>          Issue Type: Bug
>    Affects Versions: 2.7
>         Environment: Windows XP SP2, Eclipse 3.2.2 (build M20070212-1330)
>            Reporter: Joe
>            Priority: Critical
>         Attachments: test.xml, test.xsl, test_output.xml
>
>
> When a text comparison on an empty node is performed, it never returns true.  
> For example, if I were to use this variable:
>     <xsl:variable name="testcase1" select="text()=''"/>
> this will always return false.
> Yet, if I do:
>     <xsl:variable name="testcase1" select="string-length(text())=0"/>
> This returns the correct result.
> I will attach a test case to this bug report.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to