Hi Daniel,
I think the catalog in xslt:transform() is only used for XSLT imports/includes and maybe for reading documents with doc(), and only for Saxon. The catalog is probably *not* used for mapping system identifiers in the documents accessed this way. We should document this better once we find out what is/isn’t supported.
The background is that we desperately needed to use catalogs for mapping import/include URIs, and we paid Liam to implement this. He succeeded with a little help from Christian, but it was not an easy feat because include/import URI resolution is different from doc() URI resolution in Saxon which in turn is different from system identifier resolution (that is probably done by the XML parser, not by Saxon).
So I think we need to pay Liam and Christian again so that they work out how to pass the catalog to the XML parser that is invoked by Saxon. This definitely isn’t a fun task.
Gerrit
On 02.06.2022 14:44, Zimmel, Daniel wrote:
Hi,
after reading https://docs.basex.org/wiki/Catalog_Resolver and digging in the list archives (https://mailman.uni-konstanz.de/pipermail/basex-talk/2019-March/014199.html ) I still have trouble understanding catalog files.
Is this supposed to work with xslt:transform() and BaseX GUI 9.7.2? The default option (DTD = false) is ignored by xslt:transform() because the function is definitely requesting the external DTD. This prevents transforming XML with DTD declarations that are not available (if I understand correctly, a problem that the DTD option is trying to solve in general).
When I try to solve this via catalog files (actually I do not need the DTD), I do not have success. Here are my mini examples:
Saxon HE 10.3 resides in the lib folder
.basex setting: # Local Options SERIALIZER = indent=no DTD = true
XML in local folder "C:/temp/catalog":
<!DOCTYPE dokument SYSTEM "http://www.blahblahblah.info/dtd/dokument.dtd">
<dokument> <doknr>01</doknr> </dokument>
catalog.xml in local folder "C:/temp/catalog":
<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <rewriteSystem systemIdStartString="http://www.blahblahblah.info/dtd/" rewritePrefix="file:///C:/temp/catalog/dtd/"/> </catalog>
dokument.dtd in local folder "C:/temp/catalog/dtd":
<!ELEMENT dokument (doknr)>
<!ELEMENT doknr (#PCDATA)>
XQuery query.xq in local folder "C:/temp/catalog": (# db:catfile catalog.xml #) { xslt:transform('dokument.xml', 'transform.xsl') }
With or without pragma, this always results in a java.net.UnknownHostException (because the system ID is not available, that's true), but I would be expecting this would resolve to "file:///C:/temp/catalog/dtd/dokument.dtd"
Not working in GUI nor via CCL.
What am I getting wrong?
Thanks, Daniel