Re: [xml] xinclude on same resource - xpointer="element(c2/1)" fails
- From: Daniel Veillard <veillard redhat com>
- To: c3459823592735 arcor de
- Cc: xml gnome org
- Subject: Re: [xml] xinclude on same resource - xpointer="element(c2/1)" fails
- Date: Fri, 29 Jan 2010 11:45:43 +0100
On Fri, Jan 29, 2010 at 12:26:41AM +0100, c3459823592735 arcor de wrote:
Hi,
I'm using xinclude with xpointer element()-scheme to include an existing element of the same resource at a
different location. The following bar.xml gives an example. In cruft-element with ID "c4" I'm including
<fnac>a</fnac>. In cruft-element with ID "c5" I'm trying to include <fnac>b</fnac>. In cruft-element "c6"
I'm trying to include <fnac>c</fnac> and added therefore a href="bar.xml" to avoid any "Resource Error".
I'm doing all this with IDs defined in bar.xsd. Here comes the complete example:
<bar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:noNamespaceSchemaLocation="bar.xsd">
<fnorb id="snip">
<cruft id="c1"><fnac>a</fnac></cruft>
<cruft id="c2"><fnac>b</fnac></cruft>
<cruft id="c3"><fnac>c</fnac></cruft>
<cruft id="c4"><xi:include xpointer="element(/1/1/1/1)"/></cruft>
<cruft id="c5"><xi:include xpointer="element(c2/1)"/></cruft>
<cruft id="c6"><xi:include href="bar.xml" xpointer="element(c3/1)"/></cruft>
</fnorb>
</bar>
xmllint doesn't do ID ness for XSD based validation as far as I know,
at least not by default whe XIncluding it so your ID won't be found that
way ! Use xml:id it was designed exactly for that.
Also your second and 3rd espressions are wrong, element(c2/1) will
look for an element named c2 not for an element with an ID of c2.
use id() or @id constructs.
There are examples in the source tree under test/XPath/xptr/
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]