RE: [xsl] Identify transform with disabled output escaping

Subject: RE: [xsl] Identify transform with disabled output escaping
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 15 Nov 2006 19:57:20 -0000
> I have an org.w3c.dom.Node, and I would like to serialize it 
> to a String. To achieve this, I have been using this code:
> 
> void writeDOMToSourceNode(Node n, StreamResult sr) {
>     TransformerFactory trf = TransformerFactory.newInstance();
>     Transformer tr = trf.newTransformer();
>     tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
>     tr.transform(new DOMSource(n), sr);
>     //exception handling and turning the sr into a String omitted }
> 
> i.e. transform the Node with an empty stylesheet. Now this 
> code gives me the strange stuff with all the &gt;s et al.

So the next question has to be, what's in the DOM? From the evidence of the
serialized output, it's some text nodes with lots of angle brackets in the
text.

Have you tried using the DOM's serialization methods (toXML() or whatever)
directly?

Michael Kay
http://www.saxonica.com/

Current Thread