I have had success using xmllint to access nodes using xpath.
I can't tell you how well it supports xpath, but I am able to do things like the example below, which turns a chapter into a preface and changes the title.
<preface>
<xi:include href="ebook-intro.xml"
xpointer="xmlns(d=http://docbook.org/ns/docbook)xpointer(/d:chapter/d:info/following-sibling::*))"/>
</preface>
I vaguely remember being told that the support for xinclude in xmllint is neither complete nor standard, so I wouldn't expect the markup above to work for any other tool, but xmllint does what I need:-).
Regarding the question of pulling the second listitem from a section with a particular id, I think the following will do the trick (I don't claim it's the most elegant way to do this, but it works with xmllint):
<xi:include href="filename.xml"
xpointer="xmlns(d=http://docbook.org/ns/docbook)xpointer(//d:section[@xml:id='sect-a']//d:listitem[2]))"/>
Best regards,
Dick
-------
XML Press
XML for Technical Communicators
http://xmlpress.nethamilton@xmlpress.netOn Sep 14, 2014, at 7:34, Stefan Seefeld <
stefan@seefeld.name> wrote:
> On 09/14/2014 05:09 AM, Jirka Kosek wrote:
>> On 14.9.2014 3:22, Stefan Seefeld wrote:
>>> Can anyone confirm the state of xpointer support in xsltproc, or any
>>> other Free XSLT processor for that matter ? (For example, what about
>>> saxon ?) Are there any (free) test suites that I could use to get a
>>> sense of what is supported and what not ?
>> AFAIK only thing which is reliable and works across different
>> implementations is referencing node by its ID. Very sad.
>
> That's sad indeed. I was trying to fetch a specific subnode of an
> identified element, but couldn't manage to get that working with
> xsltproc (haven't tried with saxon yet), so I was looking for working
> examples.
>
> (I'm not even sure what the right spelling is to express "second
> listitem within a section with id "demo" " using xpointers. And xsltproc
> typically doesn't even give an error. It simply ignores the entire
> xpointer attribute :-( )
>
>> There is XInclude test suite, which has some XPointer tests as well:
>>
>>
http://dev.w3.org/cvsweb/2001/XInclude-Test-Suite/>
> Thanks. These tests all are rather old, and limited as far as I can see.
> Hasn't there been any recent activity on xpointers recently ? What other
> tools for transclusion are people using nowadays ?
>
> Thanks,
> Stefan
>
> --
>
> ...ich hab' noch einen Koffer in Berlin...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org> For additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org>