Probably related:

db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*"))
⇒ 0

db:node-id(db:open('doc', 'doc.xml')/*)
⇒ 1



On 16.11.2013 23:57, Imsieke, Gerrit, le-tex wrote:
I think that under certain conditions, the path() function does not
return the proper paths.

Here’s an example that works ok:

for $doc in <doc><a/><b><c/></b></doc>
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
   for $node in $nodes
   return <result path="{path($node)}" name="{name($node)}"/>

⇒
<result path="Q{http://www.w3.org/2005/xpath-functions}root()/Q{}a[1]"
name="a"/>
<result path="Q{http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]"
name="b"/>
<result
path="Q{http://www.w3.org/2005/xpath-functions}root()/Q{}b[1]/Q{}c[1]"
name="c"/>

Now I create a database 'doc' with the document 'doc.xml' and invoke the
slightly modified query:

for $doc in db:open('doc', 'doc.xml')/*
let $nodes as element(*)* := xquery:eval("$doc//*", map{"doc":=$doc})
return
   for $node in $nodes
   return <result path="{path($node)}" name="{name($node)}"/>

⇒
<result path="Q{http://www.w3.org/2005/xpath-functions}root()" name="a"/>
<result path="Q{http://www.w3.org/2005/xpath-functions}root()" name="b"/>
<result path="Q{http://www.w3.org/2005/xpath-functions}root()" name="c"/>

The element names are still known, but not their paths. Is it a bug or
am I missing something?

Gerrit

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to