Page 1 of 1

resolve xinclude through catalog

Posted: Fri Dec 18, 2020 2:32 am
by Krille
Hi,

my team has a large project with files in many subfolders. We'd like to use XInclude for including common stuff from a file called Vokabular.xml which lives in the project root.

Including with relative works fine when creating new files via templates. The following complex XPath expression gets expanded to a correct relative path in the project folder structure:

Code: Select all

<xi:include href="${xpath_eval(concat( string-join((tokenize(replace(substring-after('${cfdu}', '${pdu}'), '^/', ''), '/') ! '../'), ''), 'Vokabular.xml') )}" xpointer="encodingDesc"/>
But this technique is not robust against moving the files to an other folder level. That's why we'd prefer resolving the included stuff through a catalog file.

Code: Select all

<xi:include href="http://wwu.de/ArabistikIslam/ALEA/Vokabular.xml" xpointer="encodingDesc"/>
Here is the catalog entry (from ${pdu}/resources/catalog.xml):

Code: Select all

<uriSuffix uriSuffix="ALEA/Vokabular.xml" uri="../Vokabular.xml"/>
But the include fails. I set the logging to verbose and the related
message are:

Code: Select all

Description: Could not resolve PublicID: [null] SystemID: [http://wwu.de/ArabistikIslam/ALEA/Vokabular.xml]
Description: Resolved URI: [http://wwu.de/ArabistikIslam/ALEA/Vokabular.xml]	[file:/home/clueck/Projekte/edition-ibn-nubatah/Vokabular.xml]
Description: Could not resolve PublicID: [null] SystemID: [http://wwu.de/ArabistikIslam/ALEA/Vokabular.xml]
What's going wrong here?

Kind regards,
Christian

Re: resolve xinclude through catalog

Posted: Fri Dec 18, 2020 10:24 am
by Radu
Hi Christian,

In the same XML catalog file can you also add a system suffix mapping like:

Code: Select all

<systemSuffix systemIdSuffix="ALEA/Vokabular.xml" uri="../Vokabular.xml"/>
?
Also these relative paths that you specify in the XML catalog like ../Vokabular.xml are interpreted relative to the location of the XML catalog file.

Regards,
Radu

Re: resolve xinclude through catalog

Posted: Fri Dec 18, 2020 1:43 pm
by Krille
Hi Radu,

great, that works. Thank you!

Regards,
Christian