Re: [xml] Relative paths in XPointer

On Wed, Feb 25, 2004 at 09:45:37PM +0100, Manuel González Castro wrote:

The "XPointer xpointer() Scheme Working Draft" ( says that the function 
"here()" can be used to point locations using relative paths. I'm trying to get it working with xmllint, 
but I'm getting errors whenever I use XInclude with XPointer relative paths.

I haven't seen any bug related to this error, and I think my xpointer expressions are correct.

So, does libxml support "here()" and other relative-path functions like "parent::*" inside xpointer 

I'm using xmllint built on W2K from today CVS, and here are the testcases:

And this is the same with an xpointer relative path:

D:\tests>type xpointer_relative.xml

  <b id="1"/>
  <b id="2"/>
    <xi:include xpointer="xpointer(here()/parent::*/parent::*/b[ id='1'])" 
Any hint?

  You're playing with fire. The problem is what here() should be pointing
to. Assuming no XInclude processing and an evaluation of XPointer in the
document XPath data model of the given document, then here() should probably
point to the xi:include element.
  Now the problem is that you're running on an XIncluded document. As part
of the XInclude processing the xi:include element is discarded and replaced
by the evaluation of the include selection. And that selection start on an
element which doesn't exists anymore.
  I don't think it's a good idea to try to match XPointer here() and 
XInclude processing, since basically there is a deep conflict between 
both, and I doubt you will end up with a reliable solution in any case.

  But it's an interesting example :-)


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]