people,

I understand Xerces has some internal DOM sanity checks that do not
allow you to create a non-wellformed DOM. In particular, it doesn't
allow you to create text nodes that are not included into any element.

This prevents many interesting features of XSLT text output, for
example, VRML rendering or Java code creation, the last being _very_
important in Cocoon since it will be the base for page compilation.

I request this limitation to be removed and thus allowing a DOM tree to
be just a text wrapper, in some senses. I give you an example

<?xml version="1.0"?>
<echo message="Hello, World!"/>

then

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="text"/>  
 <xsl:template match="echo">
public class Echo {
  public static void main(String args[]) {
    System.println("<xsl:value-of select="@message"/>");
  }
}
 </xsl:template> 
</xsl:stylesheet>

I get the following exception

org.apache.xerces.dom.DOMExceptionImpl: HIERARCHY_REQUEST_ERR
                       at
org.apache.xerces.dom.NodeImpl.internalInsertBefore(NodeImpl.java:666)
                       at 
org.apache.xerces.dom.NodeImpl.insertBefore(NodeImpl.java:577)
                       at
org.apache.xerces.dom.DocumentImpl.insertBefore(DocumentImpl.java:246)
                       at 
org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:387)
                       at
org.apache.xalan.xpath.xml.FormatterToDOM.append(FormatterToDOM.java:136)
                       at
org.apache.xalan.xpath.xml.FormatterToDOM.characters(FormatterToDOM.java:301)
                       at
org.apache.xalan.xslt.XSLTEngineImpl$ResultTreeHandler.characters(Compiled
Code)
                       at
org.apache.xalan.xslt.ElemTextLiteral.execute(ElemTextLiteral.java:114)
                       at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElement.java:507)
                       at 
org.apache.xalan.xslt.ElemTemplate.execute(ElemTemplate.java:141)
                       at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:405)
                       at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:571)
                       .... (cocoon stack trace skipped)

I don't know how hard this is to fix, but we need a way to be able to
let the XSLT processor do something like that since it's perfectly
legal.

I consider this a bug, expecially since it exists a "text" output method
in XSLT and we must be able to make it work.

--
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<[EMAIL PROTECTED]>                             Friedrich Nietzsche


Reply via email to