id and element-with-id behaviour
Tuesday, 22 November 2011 · 2 messages
AB
Andy Bunce22 Nov 2011 16:31 #
Hi,
The BaseX 7.0.2 handling of
fn:element-with-id seems wrong to me. BaseX seems to treat attributes named id as ids - fair enough, I guess it has no id elements.
http://www.w3.org/TR/xpath-functions-30/#func-element-with-id says: The effect of this function is identical to fn:id in respect of elements that have an attribute with the is-id property.
so given:let $xml :=document{
<a id="0">
<b id="1" >f</b>
<b id="2"><g id="2.1">hello</g></b>
<b xml:id="3">goodbye</b>
</a>
}
I would expect $xml/id("1") and $xml/element-with-id("1") to both return
<b id="1">f</b> .
------result--------------------------------------------------------
<b id="1">f</b>
----
<a id="0">
<b id="1">f</b>
<b id="2">
<g id="2.1">hello</g>
</b>
<b xml:id="3">l</b>
</a>
---------------------------
/AndyCG
Christian Grün22 Nov 2011 16:35 #
Thanks Andy,
yes, this looks like a bug, which I've just memorized in GitHub:
https://github.com/BaseXdb/basex/issues/285
Thanks,
Christian
Quoted text · Andy Bunce · 40 lines
On Tue, Nov 22, 2011 at 4:31 PM, Andy Bunce <bunce.andy at gmail.com> wrote: > Hi, > > The BaseX 7.0.2 handling of fn:element-with-id seems wrong to me. > BaseX seems to treat attributes named id as ids - fair enough, I guess it > has no id elements. > > http://www.w3.org/TR/xpath-functions-30/#func-element-with-id says: > The effect of this function is identical to fn:id in respect of elements > that have an attribute with the is-id property. > so given: > let $xml :=document{ > <a id="0"> > <b id="1" >f</b> > <b id="2"><g id="2.1">hello</g></b> > <b xml:id="3">goodbye</b> > </a> > } > I would expect $xml/id("1") and $xml/element-with-id("1") to both return <b > id="1">f</b> . > > ------result-------------------------------------------------------- > <b id="1">f</b> > ---- > <a id="0"> > <b id="1">f</b> > <b id="2"> > <g id="2.1">hello</g> > </b> > <b xml:id="3">l</b> > </a> > --------------------------- > /Andy > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery