Thanks for spelling it out for me.  :)
,
Josh.
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Thursday, June 16, 2005 8:48 AM
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] FW: Transformation Error

Every stylesheet has built-in template rules to match nodes for which there are no explicit template rules. The built-in template rules recurse down the tree, and the built-in rules for text nodes output the contents of the text node.
 
See http://www.w3.org/TR/xslt20/#built-in-rule
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Fenlason, Josh
Sent: 16 June 2005 14:40
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] FW: Transformation Error

Thanks for taking the time to explain.  It was helpful.  However, I still don't understand why a stylesheet that selects nothing has a result tree that contains anything.  It would seem logical that since the sytlesheet selects nothing, the result would contain nothing.  Am I totally off base?  Thanks.
,
Josh.
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: Wednesday, June 15, 2005 5:26 PM
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] FW: Transformation Error

Your stylesheet seems to be creating a result tree that contains a document node with a text node as its child. This is allowed in the XPath data model, but it isn't allowed in DOM: see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1590626202. Passing a transformation result that isn't a well-formed document (ie one where the document node has text nodes, or zero element nodes, or multiple elements nodes, as its children) seems inadvisable.
 
Saxon could arguably get round this by creating a DocumentFragment rather than a Document node as the root of the tree. However, I suspect this would stop many applications from working. Perhaps this is what the Xalan/Xerces combination is doing ("Java 1.5 without Saxon in my classpath").
 
In the case of a SAXResult, Saxon explicitly checks that the result represents a well-formed document. Arguably it should do a similar check for a DOMResult, to give a cleaner failure message.
 
You should only really use DOM with Saxon if you have to, because of incompatibilities in the data model (of which this is an example). Doing what your application here is doing, constructing a DOM representation of the input file and then passing that as the source to Saxon, is incredibly inefficient. If you're starting with serial XML, always use a SAXSource or StreamSource.
 
Michael Kay
http://www.saxonica.com/
 


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Fenlason, Josh
Sent: 15 June 2005 15:34
To: saxon-help@lists.sourceforge.net
Subject: [saxon] FW: Transformation Error

I have a problem in Saxon 8.4.  Transforming with a empty stylesheet gives the error below.  This works in Saxon 6.5.3, but now fails in 8.4.  Also, if I run the test in Java 1.4.2 without Saxon in my classpath, it fails.  Running the test in Java 1.5 without Saxon in my classpath, it completes.  Running in either Java 1.4.2 or 1.5 with Saxon 8.4 in my classpath fails.  Does this look like a bug?  I have attached a simple test to help demonstrate the issue.  Thanks.
,
Josh.
 
 
 
net.sf.saxon.trans.DynamicError: org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR: This node isn't allowed there.
        at net.sf.saxon.dom.DOMEmitter.characters(DOMEmitter.java:121)
        at net.sf.saxon.event.ProxyReceiver.characters(ProxyReceiver.java:202)
        at net.sf.saxon.event.ComplexContentOutputter.characters(ComplexContentOutputter.java:110)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:341)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:289)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:331)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:289)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:331)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:289)
        at net.sf.saxon.Controller.transformDocument(Controller.java:1367)
        at net.sf.saxon.Controller.transform(Controller.java:1195)
        at SaxonTest.main(SaxonTest.java:43)
Caused by: org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR: This node isn't allowed there.
        at org.apache.crimson.tree.XmlDocument.checkChildType(XmlDocument.java:616)
        at org.apache.crimson.tree.ParentNode.appendChild(ParentNode.java:341)
        at org.apache.crimson.tree.XmlDocument.appendChild(XmlDocument.java:664)
        at net.sf.saxon.dom.DOMEmitter.characters(DOMEmitter.java:119)
        ... 11 more