File f = new File(xmlName); SAXBuilder builder = new SAXBuilder(); Document xmlSource = builder.build(f);
File xsltFile = new File(xsltName); Source xslSource = new StreamSource(xsltFile); TransformerFactory transFact = TransformerFactory.newInstance(); Templates templates = transFact.newTemplates(xslSource); Transformer trans = templates.newTransformer();
JDOMSource in = new JDOMSource(xmlSource); JDOMResult res = new JDOMResult(); trans.transform(in, res); Document r = res.getDocument(); XMLOutputter xout = new XMLOutputter(); xout.output(res.getDocument(), System.out); } } ===================================================================
When I compile and run this little app with JDK 1.4.2 everything works fine. When doing the same with JDK 1.5 it fails with
The XSLT file 'bla.xslt' for this test case is very simple: =================================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
The corresponding XML file: =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <bla>a</bla> ===================================================================
Could it be that the XSLT implementation within the JDK has changed somehow and that the JDOMResult is not (yet) "compatible" in some way with JDK 1.5? Any ideas how to overcome this?
I'm experiencing the same behaviour on MacOSX and Linux.
TIA, Thomas
_______________________________________________ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)