From: "Peter Ring" <PRI@magnus.dk>
To: "Jirka Kosek" <jirka@kosek.cz>,<davep@dpawson.co.uk>
CC: "Gurra Green" <gurra_green@hotmail.com>,"Docbook-Apps"
<docbook-apps@lists.oasis-open.org>
Subject: RE: [docbook-apps] Alternative to entities?
Date: Tue, 18 Jan 2005 14:32:51 +0100
Give it a try. In my experience, XInclude is well integrated in XXE.
First, on the Options | Edit tab, you'd have selected Type of document
reference: 'XInclude' or 'Entity when possible, XInclude otherwise'.
Then you could go along like this:
1) open both entities.xml and the document that you are authoring
2) select the element in entities.xml that you want to reference
3) select Edit | Document Reference | Copy as Reference or type
Ctrl+Shift+C
4a) to insert an inline element, set the insertion point in your document
and type Ctrl+V
4b) to insert a block element, set the insertion point in your document and
type Ctrl+U (paste before) or Ctrl+W (paste after).
There's a tutorial [1].
The reference could look like this
<xi:include href="entties.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xpointer="productname" />
or
<xi:include href="entties.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xpointer="element(productname)" />
or
<xi:include href="entties.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xpointer="xpointer(id('productname'))" />
or
<xi:include href="entties.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xpointer="element(/1/2/3)" />
AFAIK, there's a couple of limitations. Not all off the XPointer scheme is
supported; the XPointer expression must yield a result infoset with one
node; and one particular feature that I miss
<xi:include href="some-source-code-or-xml-file"
xmlns:xi="http://www.w3.org/2001/XInclude"
parse="text">
XXE will quote the included file as it is supposed to, but the reference
will be gone, replaced by the quoted content of the included file.
[1] http://www.xmlmind.com/xmleditor/tutorial.html#id.s2
kind regards
Peter Ring
> -----Original Message-----
> From: Jirka Kosek [mailto:jirka@kosek.cz]
> Sent: 17. januar 2005 19:52
> To: davep@dpawson.co.uk
> Cc: Gurra Green; Docbook-Apps
> Subject: Re: [docbook-apps] Alternative to entities?
>
>
> Dave Pawson wrote:
>
> > Not speaking from experience.
> >
> > If an xinclude aware processor is used,
> > could that stand in for XML entities Jirka?
>
> Yep, you can use something like
>
> <xi:include href="entities.xml#productname"/>
>
> to pull element from external file entities.xml:
>
> <root>
> <phrase xml:id="productname">SuperSoft v3.5</phrase>
> ...
> </root>
>
> But as you can see XInclude is quite verbose in this case and I'm not
> sure whether XXE can deal with such XIncludes.
>
> --
> ------------------------------------------------------------------
> Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz
> ------------------------------------------------------------------
> Profesionální ¹kolení a poradenství v oblasti technologií XML.
> Podívejte se na ná¹ novì spu¹tìný web http://DocBook.cz
> Podrobný pøehled ¹kolení http://xmlguru.cz/skoleni/
> ------------------------------------------------------------------
>
>