Re: [xml] Relative paths in XPointer



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

The "XPointer xpointer() Scheme Working Draft" (http://www.w3.org/TR/xptr-xpointer/) 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 
expressions?

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

<a>
  <b id="1"/>
  <b id="2"/>
  <c>
    <xi:include xpointer="xpointer(here()/parent::*/parent::*/b[ id='1'])" 
xmlns:xi="http://www.w3.org/2003/XInclude"/>
  </c>
</a>
[...]
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

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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