Hi Gerrit,
Thank you for the hint! Removing quotes from the pragma did not work in this case.
(# db:catfile schemas/catalog.xml #)
The catalog file is also configured at the beginning of the query:
declare option db:catfile 'schemas/catalog.xml';
This detail about not needing quotes in a pragma is worth remembering though!.
Vincent
_____________________________________________ Vincent M. Lizzi Head of Information Standards | Taylor & Francis Group vincent.lizzi@taylorandfrancis.commailto:vincent.lizzi@taylorandfrancis.com
Information Classification: General From: BaseX-Talk basex-talk-bounces@mailman.uni-konstanz.de On Behalf Of Imsieke, Gerrit, le-tex Sent: Thursday, July 9, 2020 1:18 AM To: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] xslt:transform function not working with XML Catalog
Hi Vincent,
I feel your pain. Maybe this comment helps: https://github.com/BaseXdb/basex/issues/1793#issuecomment-579134499https://github.com/BaseXdb/basex/issues/1793#issuecomment-579134499 (omit the quotes in the pragma).
I documented it here, too: https://docs.basex.org/wiki/Catalog_Resolver#Additional_Noteshttps://docs.basex.org/wiki/Catalog_Resolver#Additional_Notes "The catalog location in the pragma can be given relative to the current working directory (the directory that is returned by file:current-dir()) or as an absolute operating system path. The catalog location in the pragma is not an XQuery expression; no concatenation or other operations may occur in the pragma, and the location string must not be surrounded by quotes."
Gerrit
On 09.07.2020 06:32, Lizzi, Vincent wrote:
Hi Liam,
Thanks for the reply and suggestions. Based on your suggestion I tried pragmas and strace, and had another go at CatalogManager.properties, but they've not had any effect. (I'm using Windows 10 but was able to run strace in Ubuntu via WSL). This query:
try {
(# db:catfile 'schemas/catalog.xml' #)
(# db:intparse false #)
(# db:dtd true #)
(# db:chop false #)
{ xslt:transform('file.xml', 'stylesheet.xsl')//inlinegraphic }
} catch * { $err:description }
Produces the same error again due to the DTD not being available at the system literal URI.
I did try setting verbosity 99 in a CatalogManager.properties file on the classpath, but this did not produce any additional messages. I also tried setting the same properties directly when launching BaseX this did not work either. Specifically, I set the following system properties when launching BaseX, and then used proc:property() in a query to confirm that these system properties were in fact set.
'xml.catalog.verbosity': '99'
'xml.catalog.ignoreMissing': 'no'
'xml.catalog.catalog-class-name': 'org.apache.xml.resolver.Resolver'
'xml.catalog.files': 'schemas/catalog.xml'
xml-resolver-1.2.jar and Saxon are definitely on the classpath.
Thanks,
VIncent
*Vincent M. Lizzi*
Head of Information Standards | Taylor & Francis Group
vincent.lizzi@taylorandfrancis.commailto:vincent.lizzi@taylorandfrancis.com mailto:vincent.lizzi@taylorandfrancis.com
Information Classification: General
*From:* Liam R. E. Quin <liam@fromoldbooks.orgmailto:liam@fromoldbooks.org> *Sent:* Wednesday, July 8, 2020 10:28 PM *To:* Lizzi, Vincent <Vincent.Lizzi@taylorandfrancis.commailto:Vincent.Lizzi@taylorandfrancis.com>; BaseX <basex-talk@mailman.uni-konstanz.demailto:basex-talk@mailman.uni-konstanz.de> *Subject:* Re: [basex-talk] xslt:transform function not working with XML Catalog
On Wed, 2020-07-08 at 22:46 +0000, Lizzi, Vincent wrote:
I've encountered a problem using xslt:transform in to transform some old XML that contains a DTD DOCTYPE system literal pointing to a non- working URI and also uses ENTITYREF attributes to refer to image files. I have the XML Catalog configured correctly using CATFILE.
If this is on Linux, using strace can help check which catalog file is being used; you can also turn on debugging in a CatalogManager.properties file containing the line verbosity = 999 (thee file needs to be in your Java classpath).
There's also a BaseX pragma, (# db:catfile path/to/catalog.xml #) { transform(...) }
You need to turn off the BaseX internal parser.
Make sure that the resolver library and of course saxon are in your class path.
You may need to add, declare option db:catfile "path/relative/to/cwd/catalog.xml"; to your query.
Liam
-- Liam Quin, https://www.delightfulcomputing.com/https://www.delightfulcomputing.com <https://www.delightfulcomputing.comhttps://www.delightfulcomputing.com> Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.orghttp://www.fromoldbooks.org
-- Gerrit Imsieke Geschäftsführer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@le-tex.demailto:gerrit.imsieke@le-tex.de, http://www.le-tex.dehttp://www.le-tex.de
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930
Geschäftsführer / Managing Directors: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt