resolve xinclude through catalog

Oxygen general issues.
Krille
Posts: 33
Joined: Thu Nov 12, 2020 12:24 pm

resolve xinclude through catalog

Post 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
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: resolve xinclude through catalog

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Krille
Posts: 33
Joined: Thu Nov 12, 2020 12:24 pm

Re: resolve xinclude through catalog

Post by Krille »

Hi Radu,

great, that works. Thank you!

Regards,
Christian
Post Reply