Hi Stefan,
On Sun, 14 Apr 2013 20:06:45 -0400
Stefan Seefeld <
stefan@seefeld.name> wrote:
> On 04/14/2013 03:24 PM, Thomas Schraitle wrote:
> > If your variablelist has the ID "foo" and you want to refer to the
> > first varlistentry you can write:
> > xmlns(db=http://docbook.org/ns/docbook)xpointer(id(foo)/db:varlistentry[1])
>
> Right, but that doesn't solve my problem of having to repeat the
> namespace declaration. :-)
That's true. :-) I had mainly speed and simplification in mind than
solving the namespace declaration. It could be slightly faster than
using the descendant axis with //db:variablelist -- if supported by
your favorite XML parser.
> [...]
> > I don't think there is a general solution where you define
> > somewhere the namespace and just refer to it. It seems, you need to
> > add the namespace xmlns() scheme every time.
>
> That's unfortunate. I was hoping there was a mechanism such as
> xmlns-local() to export the namespaces from the current document into
> the xpointer context.
I could be wrong, but I haven't seen that. As some of the XPointer
specification never reached recommendation status, I would doubt there
is something like a xmlns-local().
> > Maybe you add the xmlns() XPointer scheme before passing it to your
> > XML parser. You could (theoretically) apply an XSLT transformation
> > step and add the xmlns() scheme. That way you could avoid entities,
> > however, you add an additional step (which may not be useful).
>
> I wouldn't mind the additional step, but I don't like the idea that
> the unprocessed document isn't valid any longer.
Right, that's unfortunate.
Anyway, that reminds me of DocBook assemblies:
http://docbook.org/tdg51/en/html/ch06.htmlIt is a pretty new method of splitting your document into modules and
referring to with a "map file" (named assembly). It may not help to
solve your current situation, but it would be something for the future.
As DocBook 5 is (or should be) the future, I think, this would be an
interesting topic.
However, it seems, the current implementation doesn't support
"XML fragments" like referring to a certain element inside a XML file
or using an XPath to select specific elements. It might be worth to
bring this to the DocBook committee what they recommend in this case.
I've opened a new thread on the docbook mailinglist (subject: "DocBook
5 Assemblies and XML Fragments"). This is something I would like to
know too. :))
--
Gruß/Regards,
Thomas Schraitle