Closed
Bug 174021
Opened 22 years ago
Closed 22 years ago
count(text()) is > 0 even if context node contains no text elements
Categories
(Core :: XSLT, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: maros.ivanco, Assigned: peterv)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2a) Gecko/20020910
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2a) Gecko/20020910
count(text()) > 0 even if context node contains no text elements, see test.xml
and test.xsl .
Assuming:
The child axis contains the children of the context node, see:
http://www.w3.org/TR/xpath#axes
text() selects all text node children of the context node, see:
http://www.w3.org/TR/xpath#node-tests
Reproducible: Always
Steps to Reproduce:
1.crate files test.xml and test.xsl with contents from Additional Information.
2.open test.xml in mozilla
3.
Actual Results:
mozilla display 'wrong'
Expected Results:
'right'
<!----------- test.xsl ----------->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/core">
<html>
<body>
<xsl:choose>
<xsl:when test="count(text()) > 0">
wrong
</xsl:when>
<xsl:otherwise>
right
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<!------------- test.xml ------------->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<core>
<memory>
<BANK_COUNT>1</BANK_COUNT>
<size>65536</size>
<unitSize>1</unitSize>
<unitName>Byte</unitName>
</memory>
</core>
there's a textnode containing only whitespace between the <core> and the
<memory>. Since the default is to preserve whitespace
(http://www.w3.org/TR/xslt#strip) that whitespace textnode will be perserved.
Try setting
<xsl:strip-space elements="core" />
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Summary: count(text()) is > 0 even if context node contains no text elements → count(text()) is > 0 even if context node contains no text elements
You need to log in
before you can comment on or make changes to this bug.
Description
•