Hi Gerrit,
db:node-id(xquery:eval("db:open('doc', 'doc.xml')/*")) => 0
some quick feedback (I'll further look into this): when running xquery:eval, a main-memory copy of the original node is created, which may have another node id than the original node. To get the node id of the original node, you'll have to embed your db:node-id call into the xquery:eval code:
xquery:eval("db:node-id(db:open('doc', 'doc.xml')/*)")
Hope this helps, Christian ___________________________
On Sun, Nov 17, 2013 at 2:51 AM, Imsieke, Gerrit, le-tex gerrit.imsieke@le-tex.de wrote:
Probably related:
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.imsieke@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