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 2002/06/21 21:55:56 UTC
DO NOT REPLY [Bug 10136] New: -
xsltc gets wrong node by position on text node set spanning two elements (position92)
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10136>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10136
xsltc gets wrong node by position on text node set spanning two elements (position92)
Summary: xsltc gets wrong node by position on text node set
spanning two elements (position92)
Product: XalanJ2
Version: CurrentCVS
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: org.apache.xalan.xsltc
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: tom.amiro@sun.com
xsltc returns the wrong text node from a variable defined by
select="/foo/*/test/text() given xml as follows
XML
---
<?xml version="1.0"?>
<foo>
<bar>
<test>1</test>
<test>3</test>
<test>5</test>
<test>7</test>
<test>9</test>
</bar>
<baz>
<test>2</test>
<test>4</test>
<test>6</test>
<test>8</test>
<test>10</test>
</baz>
</foo>
XSL
---
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- FileName: position92 -->
<!-- Document: http://www.w3.org/TR/xpath -->
<!-- DocVersion: 19991116 -->
<!-- Section: 3.3 -->
<!-- Creator: John Howard -->
<!-- Purpose: Test retrieving correct values from node-set variables by
positional predicate. -->
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="x1">
<xsl:variable name="node" select="/foo/*/test/text()"/>
<xsl:value-of select="$node[1]"/>
</xsl:variable>
<xsl:variable name="x6">
<xsl:variable name="node" select="/foo/*/test/text()"/>
<xsl:for-each select="$node[6]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="xL">
<xsl:variable name="node" select="/foo/*/test/text()"/>
<xsl:for-each select="$node[last()]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<out>
<x1><xsl:value-of select="$x1"/></x1><xsl:text> </xsl:text>
<x6><xsl:value-of select="$x6"/></x6><xsl:text> </xsl:text>
<xL><xsl:value-of select="$xL"/></xL>
</out>
</xsl:template>
</xsl:stylesheet>
Obtained output
---------------
<?xml version="1.0" encoding="UTF-8"?>
<out><x1>1</x1>
<x6>1</x6>
^----------- the 1 should be a 2
<xL>10</xL></out>
Expected output
---------------
<?xml version="1.0" encoding="UTF-8"?>
<out><x1>1</x1>
<x6>2</x6>
<xL>10</xL></out>
The variable should have the combined set of text nodes from both the <bar>
and <baz> elements, so the 6th position should return the first text
node from <baz> which has a value of "2"