Xinclude elements from the same document

Oxygen general issues.
martindholmes
Posts: 176
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Xinclude elements from the same document

Post by martindholmes »

I'm trying to get around the huge amount of duplication that typically happens in TEI documents, where titles, authors and similar info tend to appear in two or three different places. I'm doing this by using XInclude to include data from one part of the document in another part of the same document, like this:

...
<title type="main"><xi:include href="" xpointer="element(mainTitle)/*"><xi:fallback>[Main title is missing]</xi:fallback></xi:include></title>
...

<title level="a" type="main" xml:id="mainTitle">Towards Higher Ground</title>

Here, the contents of the second title element, which has the xml:id "mainTitle", should (I think) be xincluded into the first title element. I'm not 100% sure I have the xpointer syntax right, but my main problem right now is that oXygen doesn't seem to be able to process any XInclude statement which refers to another location in the same document; this is the error I get when I try to validate the document against an RNG schema:

Include operation failed, reverting to fallback. Resource error reading file as XML (href=''). Reason: An xpointer was specified that points to a location in the source infoset. This location cannot be accessed due to the streaming nature of the processor.

Is there any way I can get oXygen to validate a document like this?

Cheers,
Martin
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Martin,

The XInclude is processed as the document is parsed so references to the same document will not work. However there is a simple solution, place the common content in a separate file and XInclude it from all the places you need it.

Best Regards,
George
George Cristian Bina
Post Reply