M
McSwell
I want to xi:include (part of) a single XML file twice in the same XML
document, and while it seems like it should be easy... well, that's
always my experience with XML: the hard things it does easily, the
simple things are what trip me up.
The file to be included is named fragUnicodePhonemes.xml, and it looks
like this:
---------------------------------
<?xml version="1.0" encoding="utf-8"?>
<src:fragment xml:id = "fragUnicodePhonemes"
xmlns:src = "http://docbook.sourceforge.net/release/
litprog/current/dtd/ldocbook.dtd"
(other namespace declarations here)
<Ph
honemeSet xml:id = "UrduPhonemeSet)">
(lots of messy stuff here)
</Ph
honemeSet>
</src:fragment>
---------------------------------
As you may guess, I'm using an <src:fragment> Literate Programming
construct, shamelessly stolen and modified to work with DocBook 5.
I want to embed the above <Ph
honemeSet> in two different places (one
happens to be an appendix, which maybe explains the redundancy). One
time the entire <src:fragment> gets embedded (so it can be extracted
using the Lit Prog style sheet):
<xi:include href="fragUnicodePhonemes.xml"
xpointer="element(fragUnicodePhonemes)" />
The other time only the <Ph
honemeSet> gets embedded:
<xi:include href="fragUnicodePhonemes.xml"
xpointer="element(UrduPhonemeSet)" />
The problem is that the <Ph
honemeSet xml:id = "UrduPhonemeSet)">
element gets embedded both times (once inside the <src:fragment>, and
once by itself)--and so its xml:id shows up twice, which means it
flunks validation (xsltproc complains).
If I could get it to omit the xml:id when it embeds the element, I
guess it would be fine (the only use of the id is to "find" the
element in the external file so it can be embedded, although I suppose
it could end up being used for something else). Or maybe I should
just ignore the warning, taking Mad Magazine's advice: What, me
worry? Or maybe I should change the '<' and '>' to '<' and '>'
before embedding them, although that feels like a kludge. Or maybe I
should just reference the first occurrence in the appendix, instead of
a including it a second time; but that would be more obscure than I
would like. Or maybe there's a way to define it as an entity...
Suggestions?
Mike Maxwell
CASL/ U MD
document, and while it seems like it should be easy... well, that's
always my experience with XML: the hard things it does easily, the
simple things are what trip me up.
The file to be included is named fragUnicodePhonemes.xml, and it looks
like this:
---------------------------------
<?xml version="1.0" encoding="utf-8"?>
<src:fragment xml:id = "fragUnicodePhonemes"
xmlns:src = "http://docbook.sourceforge.net/release/
litprog/current/dtd/ldocbook.dtd"
(other namespace declarations here)
<Ph
(lots of messy stuff here)
</Ph
</src:fragment>
---------------------------------
As you may guess, I'm using an <src:fragment> Literate Programming
construct, shamelessly stolen and modified to work with DocBook 5.
I want to embed the above <Ph
happens to be an appendix, which maybe explains the redundancy). One
time the entire <src:fragment> gets embedded (so it can be extracted
using the Lit Prog style sheet):
<xi:include href="fragUnicodePhonemes.xml"
xpointer="element(fragUnicodePhonemes)" />
The other time only the <Ph
<xi:include href="fragUnicodePhonemes.xml"
xpointer="element(UrduPhonemeSet)" />
The problem is that the <Ph
element gets embedded both times (once inside the <src:fragment>, and
once by itself)--and so its xml:id shows up twice, which means it
flunks validation (xsltproc complains).
If I could get it to omit the xml:id when it embeds the element, I
guess it would be fine (the only use of the id is to "find" the
element in the external file so it can be embedded, although I suppose
it could end up being used for something else). Or maybe I should
just ignore the warning, taking Mad Magazine's advice: What, me
worry? Or maybe I should change the '<' and '>' to '<' and '>'
before embedding them, although that feels like a kludge. Or maybe I
should just reference the first occurrence in the appendix, instead of
a including it a second time; but that would be more obscure than I
would like. Or maybe there's a way to define it as an entity...
Suggestions?
Mike Maxwell
CASL/ U MD