Hi,

I'm currently trying to use XSLTC, and I've met a little problem.
I always have this exception:
ERROR: org.xml.sax.SAXParseException: File "publishingV2.dtd" not found.
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: 
File "publishingV2.dtd" not found.
javax.xml.transform.TransformerException: 
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: 
File "publishingV2.dtd" not found.
        at 
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:457)
        at 
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:179)
        at 
net.atos.mm.fwk.XMLUtils.Transform.fromFileToStreamCompiled(Transform.java:252)
        at net.atos.mm.fwk.XMLUtils.Transform.main(Transform.java:126)
---------
when trying to use the stylesheet...

I thought it was related to the URIResolver, but when I put the Xalan 
jar instead of the XSLTC jar,
it works and the URIResolver is null too...

The publishingV2.dtd file is in the same directory as the xsl and the xml...
I must have made an error in the code...

        TransformerFactory tfactory;
        InputStream xslIS = new ByteArrayInputStream(theXSLFile.getBytes());
        InputStream xmlIS = new ByteArrayInputStream(theXMLFile.getBytes());
        StreamSource xslSource, xmlSource;

         // Create a templates object, which is the processed,
        // thread-safe representation of the stylesheet.
                if (templates == null) {
                        tfactory = TransformerFactory.newInstance();
                        xslSource = new StreamSource(xslIS);
                        // Note that if we don't do this, relative URLs 
can not be resolved correctly!
                        try {
                                xslSource.setSystemId(new 
File(xslID).toURL().toString());
                        } catch (java.net.MalformedURLException mue) {
                        }
                        templates = tfactory.newTemplates(xslSource);
                }

        // Illustrate the fact that you can make multiple transformers
        // from the same template.
                if (transformer1 == null) {
                        transformer1 = templates.newTransformer();
                }

                xmlSource = new StreamSource(xmlIS);
                try {
                        xmlSource.setSystemId(new 
File(sourceID).toURL().toString());
                } catch (java.net.MalformedURLException mue) {
                }
        transformer1.transform(xmlSource, new StreamResult(new 
ByteArrayOutputStream()));


Thanks for your help.

Bruno Verachten

Reply via email to