[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Embedding DocBook â PDF transformation in a Java web app
[Some of this exchange unintentionally fell off-list.] On 29 Jul 2023, at 22:37, Norm Tovey-Walsh <ndw@nwalsh.com> wrote: So whatâs happened here is that classpath:/xsl/juno-driver.xsl has I think this was my blunder. At one point I was doing this: factory.setURIResolver(new StandardURIResolver()); Although that class claims to support classpath: URIs, it's not an org.xmlresolver class. Omitting that line gets me further. (What gets used by default, XMLCatalogResolver?) If you use the full, absolute URI for the base stylesheet and setup a
After a lot of trial and error (quick aside: I cannot, for the life of me, get any SLF4J logging output from Saxon or org.xmlresolver classes), if I do this: private Document transformDocument(Document document) throws TransformerException, FileNotFoundException { DOMResult result = new DOMResult(); TransformerFactory factory = TransformerFactory.newInstance(); InputStream is = XmlTest.class.getResourceAsStream("/xsl/juno-driver.xsl"); Source source = new StreamSource(is, "file:/xsl/juno-driver.xsl"); Transformer transformer = factory.newTransformer(source); transformer.transform(new DOMSource(document), result); return (Document) result.getNode(); } with this catalog.xml: <?xml version="1.0" encoding="utf-8"?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <uri name="file:/xsl/juno-driver.xsl" uri="classpath:/xsl/juno-driver.xsl" /> <uri name="file:/xsl/header-footer.xsl" uri="classpath:/xsl/header-footer.xsl" /> <uri name="file:/xsl/table.xsl" uri="classpath:/xsl/table.xsl" /> <uri name="file:/xsl/titlepage.xsl" uri="classpath:/xsl/titlepage.xsl" /> <uri name="file:/xsl/docbook-xsl-1.79.2/fo/docbook.xsl" uri="classpath:/xsl/docbook-xsl-1.79.2/fo/docbook.xsl" /> <uri name="file:/xsl/docbook-xsl-1.79.2/VERSION.xsl" uri="classpath:/xsl/docbook-xsl-1.79.2/VERSION.xsl" /> <uri name="file:/xsl/docbook-xsl-1.79.2/fo/param.xsl" uri="classpath:/xsl/docbook-xsl-1.79.2/fo/param.xsl" /> </catalog> I get as far as the catalog goes. That is, at this point it fails with: Error XTSE0165: I/O error reported by XML parser processing file:/xsl/docbook-xsl-1.79.2/lib/lib.xsl: /xsl/docbook-xsl-1.79.2/lib/lib.xsl (No such file or directory) javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/xsl/docbook-xsl-1.79.2/lib/lib.xsl Which seems pretty reasonable, because that's the next included file in fo/docbook.xsl and it's not in the catalog. While I suspect this will work eventually, it seems more than slightly bogus. The 'name' attributes in the catalog.xml don't seem to matter until I get down to the DocBook files, at which point it seems to be imperative that they're 'file:' URIs. Why am I setting the system ID on that first StreamSource using a 'file:' URI? Is this all working as expected, and I just need to finish the catalog? (And if anyone can tell me how to turn on SLF4J logging output, I suspect that would be a big help!) |
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]