Referencing modules multiple times in a project

cube
Posts: 13

Referencing modules multiple times in a project

Wed Oct 16, 2013 12:45 pm

Hi,

I'd like to use the same module multiple times in my project, for example, a safety note, a standard phrase, etc.

I can import a module from my module base with an include element.

Code: Select all

<xi:include href="mymodulebase.xml" xpointer="mymodule"/>


So far, so good... Unfortunately the module is imported with its ID, but using the same ID in the project throws validation errors. It works anyway, but it would be nice to get rid of these validation errors.

Is it possible to remove the id attribute of all included elements? That would be the most elegant way, I think, because the ID is useless anyway (because it is not unique).

Thanks a lot!
cube
Radu
Posts: 5088

Re: Referencing modules multiple times in a project

Wed Oct 16, 2013 1:25 pm

Hi,

This is the limitation that the xi:include 1.0 standard has unfortunately, all IDs from the referenced document are preserved in the master document. The xi:include 1.1 standard tries to address this:

http://www.w3.org/TR/2012/WD-xinclude-11-20121009/#attribute-copying

but there is no implementation of the xi:include 1.1 standard yet available.

The only alternative would probably be to avoid having IDs at all in that reused XML content and to use an xpointer value like xpointer="element(/1/2) which means the second child of the root element, basically to use the element scheme with the xpointer instead of referencing via ID:

http://www.w3.org/TR/2003/REC-xptr-element-20030325/

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests