[xml] Relative paths in XPointer
- From: Manuel González Castro <iinmgc00 ucv udc es>
- To: <xml gnome org>
- Subject: [xml] Relative paths in XPointer
- Date: Wed, 25 Feb 2004 21:45:37 +0100
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:
---------------------------------------------------------------------
This example with an xpointer absolte path works great:
D:\tests>type xpointer_absolute.xml
<a>
<b id="1"/>
<b id="2"/>
<c>
<xi:include xpointer="xpointer(/a/b[ id='1'])" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</c>
</a>
D:\tests>xmllint --xinclude xpointer_absolute.xml
<?xml version="1.0"?>
<a>
<b id="1"/>
<b id="2"/>
<c>
<b id="1"/>
</c>
</a>
---------------------------------------------------------------------
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>
D:\tests>xmllint --xinclude xpointer_relative.xml
XPath error : Invalid type
xpointer_relative.xml:5: element include: XInclude error : XPointer evaluation failed:
#xpointer(here()/parent::*/parent::*/b[ id='1'])
xpointer_relative.xml:5: element include: XInclude error : could not load xpointer_relative.xml, and no
fallback was found
<?xml version="1.0"?>
<a>
<b id="1"/>
<b id="2"/>
<c>
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" xpointer="xpointer(here()/parent::*/parent::*/b[
id='1'])"/>
</c>
</a>
---------------------------------------------------------------------
Any hint?
Thanks,
Manuel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]