Page 1 of 1

Referencing modules multiple times in a project

Posted: Wed Oct 16, 2013 12:45 pm
by cube
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

Re: Referencing modules multiple times in a project

Posted: Wed Oct 16, 2013 1:25 pm
by Radu
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-1 ... te-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