Hi all, I don't know if this is the right place to post this, but if anyone could help, I would very much appreciate... I am trying to apply an XSLT stylesheet onto an XML generated by a java object. What the code does is this :
(...) // configure transformer TransformerFactory transformerFactory = TransformerFactory.newInstance(); Source topicMapToDocbookXSLT = new StreamSource(getServlet().getServletContext().getResourceAsStream("/xsl/topi cMapVersDocbook.xsl")); Transformer topicMapToDocbookTransformer = transformerFactory.newTransformer(topicMapToDocbookXSLT); // get XML source Document XMLTopicMap = tm.toXML(); DOMSource s = new DOMSource(XMLTopicMap); // serialize source in a file tmOs = new FileOutputStream("topicMap.xml"); XMLUtils.serialize(XMLTopicMap, tmOs); // apply XSLT DOMResult afterTmBeforeDocbook = new DOMResult(); topicMapToDocbookTransformer.transform(new DOMSource(XMLTopicMap),afterTmBeforeDocbook); // serialize result beforeDocbookOs = new FileOutputStream("afterTmBeforeDocbook.xml"); XMLUtils.serialize(afterTmBeforeDocbook.getNode(), beforeDocbookOs); (...) The serialized XML source is OK, and it is what the XSLT stylesheet expect. When I run the transformation by hand on the command line, with both the source and the stylesheet in the same directory, everything works fine (i.e : the issue is not on the generated XML source or in the stylesheet itself). But in this code, it just gives an empty output (I don't get any exceptions). This code is in a servlet, the XSLT stylesheet is in a .war file, which is itself in a .ear file. Could this have any influence on the way the stylesheet works ? should I use something like "setURIresolver" or "setSystemId" ? ... In fact it behaves like the XSLT stylesheet got an empty XML input ... What am I doing wrong ? Any help or comments welcome ! Thanks in advance Tom Thomas Francart - Mondeca 3, Cité Nollez 75018 Paris Phone : 33 (0)1 44 92 35 00 Mobile : 33 (0)6 71 11 25 97 Fax : +33 1 44 92 02 59 visit www.mondeca.com