Re: [xml] Using xpointer with xmllint



On Fri, Jun 15, 2012 at 03:20:10PM +0100, stuart shepherd wrote:
Hi

I'm having trouble using xpointer with an xinclude.
[...]
control.xml

<?xml version="1.0"?>
<root>
<control>
    <id>8</id>
    <name>ValidHd</name>
    ......
</control>
</root>

and I validate it with

xmllint --valid --xinclude --schema schema.xsd Xpointer.xml

and that works fine. But when I change the xinclude to

<xi:include href="control.xml" xpointer="xpointer(//control[../name =
'ValidHd'])"/>

  Seems your XPath expression won't select what you expect, the
//control select the nodes you intent but then you condition that
on a test using ../name. And there is no ../name for that control
node only a name child.
  use xmllint --shell control.xml
and then test your XPath expressions with the xpath shell command,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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