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

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

At any given point in the XSLT processing, . represents the current context 
node. In the 1.0 view, this item is always one node, never the empty node-set. 
The path expression text() is actually short for
./child::text()
or the set of all text nodes that are children of the current context node. 
That set could be empty, have one member, or have several members.

A test like .='' or .='foo' is trying to compare the current context node with 
a string. If that current node is an element, then XPath wants to obtain the 
string value of the current element (see part 5.2 of the XPath spec)
and compare that to the string on the other side. The string value of an empty 
element is an empty string.

> 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