• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAXP XSLT transform to DOMResult failure

 
M Galevsky
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am running the following code well:

[...]
StreamResult fileResult= new StreamResult(outputFile);
Transformer transformer = xmlWritter.newTransformer(new javax.xml.transform.stream.StreamSource("./my_sheet.xsl"));
transformer.transform(new DOMSource(dom), fileResult);
[...]

it generates the outputFile as expected.

Now, I would like to get a DOMResult instead:

[...]
DOMResult domResult= new DOMResult();
Transformer transformer = xmlWritter.newTransformer(new javax.xml.transform.stream.StreamSource("./my_sheet.xsl"));
transformer.transform(new DOMSource(dom), domResult);
[...]

But execution fails on :

ERREUR : 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it
is not permitted. '

Anyone can help ?

Thks very much,

Gal'
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that your XSL produces something that isn't an XML document. This doesn't matter when you are writing to a file, but you can't produce a DOM unless your output is a well-formed XML document.

Most likely your output doesn't have a single root element, but I suppose there are other possibilities.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic