Hi, Peter. "Ryan,Peter (Contractor)" <[EMAIL PROTECTED]> wrote on 2008-01-18 05:17:01 PM: > I am having an issue with output of data when I perform a > transformation. > > I am attempting to do a DOMSource to DOMResult transformation. My > stylesheet has the xml:output property set to "xml". > > Currently when that runs I get a DOMException: > > javax.xml.transform.TransformerException: org.w3c.dom.DOMException: > HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is > not permitted. > > This led me to think there was something wrong with the output which I > discovered by changing to a StreamSource and dumping to System.out: > > <?xml version="1.0" encoding="UTF-8"?>fieldValue fieldValue2 ... > > I would think I had something wrong with my stylesheet but I have two > reasons that make me think I have a xalan configuration error some > obscure defect. > > 1) The output of fieldValue fieldValue2 comes from my stylesheet which > should be wrapped in XML elements. > > 2) When I run the same code using SAXON 6.5.5 I get the output I am > expecting, eg: > > <?xml version="1.0" > encoding="UTF-8"?<root><firstElement>fieldValue</firstElement></secondEl > ement>fieldValue2</secondElement>... > > My transformer code is completely standard: > > public Document transform(Document document) { > Source requestSource = new DOMSource(document); > URL url = this.getClass()getResource("stylesheet.xsl"); > Source stylesheet = new StreamSource(url.toString()); > Transformer transformer = > TransformerFactory.newInstance().newTransformer(stylesheet); > Document resultDocument = > DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); > transformer.transform(requestSource, new DOMResult(resultDocument)); > Return resultDocument; > } > > I have done exhaustive digging into this and am at a complete loss. It > seems like Xalan is using the text output method but I have explicitly > named the xml method type. Does anyone have any idea what would cause > Xalan to behave in this way?
Could I ask you to provide a complete, stand-alone stylesheet, input document and Java driver program that demonstrates the problem? Thanks, Henry ------------------------------------------------------------------ Henry Zongaro XSLT Processors Development IBM SWS Toronto Lab T/L 313-6044; Phone +1 905 413-6044 mailto:[EMAIL PROTECTED]