Referencing modules multiple times in a project

Posts: 13
Joined: Mon Jul 29, 2013 6:14 pm

Referencing modules multiple times in a project

Post by cube » Wed Oct 16, 2013 12:45 pm


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!

Posts: 7469
Joined: Fri Jul 09, 2004 5:18 pm

Re: Referencing modules multiple times in a project

Post by Radu » Wed Oct 16, 2013 1:25 pm


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: ... 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:

Radu Coravu
<oXygen/> XML Editor

Post Reply