Hi Daniel,

A minor xptr/element()-spec-related point:

On 2010-01-29 11:45, Daniel Veillard wrote:
> On Fri, Jan 29, 2010 at 12:26:41AM +0100, c3459823592...@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.

The element() scheme allows for a shorthand pointer as the first step,
so 'element(c2)' is equivalent to 'xpointer(id(c2))' (and '#element(c2)'
is equivalent to '#c2'). I'm talking about the W3C spec, maybe it's
"wrong" for xmllint, but I seem to recall it working, though I can't
verify that right now.

Best,

  Piotr
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to