This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
RE: [docbook-apps] Alternative to entities?
- From: "Peter Ring" <PRI at magnus dot dk>
- To: "Jirka Kosek" <jirka at kosek dot cz>,<davep at dpawson dot co dot uk>
- Cc: "Gurra Green" <gurra_green at hotmail dot com>,"Docbook-Apps" <docbook-apps at lists dot oasis-open dot org>
- Date: Tue, 18 Jan 2005 14:32:51 +0100
- Subject: RE: [docbook-apps] Alternative to entities?
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/
> ------------------------------------------------------------------
>
>