[Bug 2729] Whitespace text nodes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2729





------- Additional Comments From davidc@nag.co.uk  2006-01-19 16:40 -------
(In reply to comment #2)
> (In reply to comment #1)
> > Are there real parsers that do this, however? 

Yes. The default parser used with saxon does this. I have slightly modified the
example given in bug #1309 to show this, making ws.xml invalid.

The default parser probably depends on the JVM which is:
$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)



ws.xml
<!DOCTYPE x [<!ELEMENT x (z*)>]>
<x>
 <y>s</y>
 <y>kill </y>
 <y>ti</y>
 <y>me </y>
</x>


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

<xsl:output method="text"/>

<xsl:template match="x">
<xsl:copy-of select="node()[position() mod 2 = 0]"/>
</xsl:template>
 
</xsl:stylesheet>



with XSLT1 you get

$ saxon ws.xml ws.xsl
skill time

with XSLT2 using a validing parser, you get validation errors but then (if you
carry on) a completely different result

$ saxon8 -v ws.xml ws.xsl
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Recoverable error on line 3 column 5 of file:/c:/tmp/ws.xml:
  SXXP0003: Error reported by XML parser: Element type "y" must be declared.
Recoverable error on line 4 column 5 of file:/c:/tmp/ws.xml:
  SXXP0003: Error reported by XML parser: Element type "y" must be declared.
Recoverable error on line 5 column 5 of file:/c:/tmp/ws.xml:
  SXXP0003: Error reported by XML parser: Element type "y" must be declared.
Recoverable error on line 6 column 5 of file:/c:/tmp/ws.xml:
  SXXP0003: Error reported by XML parser: Element type "y" must be declared.
Recoverable error on line 7 column 5 of file:/c:/tmp/ws.xml:
  SXXP0003: Error reported by XML parser: The content of element type "x" must
atch "(z)*".
kill me



and using the same parser in _non_ validating mode no warning (about validity or
white space) but again a dramatically different result from that obtained by XSLT1:

$ saxon8 ws.xml ws.xsl
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
kill me

Received on Thursday, 19 January 2006 16:40:38 UTC