First I must ask, why do you want to avoid relative references?
They are cross platform and most XML refactoring tools can handle them without issues.
In the long run you would probably be better off with the relative references rather than the hacks needed to avoid them.
Whether this is possible or not, depends on the type of reference and the type of document (DocBook DITA, etc) you're using.
For example, if you're using DocBook with XInclude, it's possible to specify a different base (xml:base) than the current file and every reference will be resolved relative to that specified base. But you will still have to specify explicitly that base at least once on the root of the document by either an absolute URI (file:///...) or a reference relative to the location of the current file (so you would still have to do this at least once per document, or customize the DTD/schema to do this for all).
Code: Select all
<article xmlns="http://docbook.org/ns/docbook" version="5.0"
<xi:include href="a/file1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
There is another way to do something like this with the help of a custom URI and an XML catalog that rewrites that URI, but you will then depend on the XML catalog. The advantage is this is portable.
You need a <protocol>
at the start of every URI. Or you could use a URN (urn:<NID>:<NSS>).
Reference in file2: tst:myproject/a/file1.xml
Create the XML catalog file in the project root folder. It will resolve/rewrite the URIs and systemIDs relative to the project root:
Code: Select all
<rewriteURI uriStartString="tst:myproject/" rewritePrefix="./"/>
<rewriteSystem systemIdStartString="tst:myproject/" rewritePrefix="./"/>
Add this XML catalog file in Oxygen's Options > Preferences, XML / XML Catalog