You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Kevin Jones <ke...@develop.com> on 2000/04/09 21:39:44 UTC

Is this a bug in Xalan's node() implementation

This is in Xalan 1.0.0 .
Given this stylesheet

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">

    <xsl:template match="/">
        NAME:<xsl:value-of select="name()"/>
        NODE:<xsl:value-of select="node()"/>
        <xsl:apply-templates select="*"/>
    </xsl:template>

    <xsl:template match="*">
        NAME:<xsl:value-of select="name()"/>
        NODE:<xsl:value-of select="node()"/>
    </xsl:template>
</xsl:stylesheet>

I'm outputting the node() of #document and the node() of the document
element.

If I transform this XML

<rowset><row><name>David</name></row></rowset>

I get this -

        NAME:
        NODE:David
        NAME:rowset
        NODE:David

which is what I'd expect.

However if I transform this XML,

<rowset>
  <row>
    <name>
      David
    </name>
  </row>
</rowset>

I get this

        NAME:
        NODE:


      David



        NAME:rowset
        NODE:

SO #document gives me all the text nodes of its descendants (that's good),
but the document element only gives me the text node of its first child
(that's bad, I think).

Modulo white space, shouldn't I get the same output in both cases? i.e.
shouldn't node() return the text nodes of the descendants of the current
element node?

Kevin Jones
DevelopMentor
www.develop.com