Hi Symantis,
The original line numbers are not stored in XML databases (they may
change after updated, and would consume additional memory), so you
won’t be able to retrieve them with XQuery.
As far as I know, this does not work in eXist-db either; the eXist
link you referenced gives you the line of the util:line-number
expression in your XQuery module. As Fabrice pointed out (thanks!),
this could also be realized with $err:line-number.
With Saxon, it works indeed. However, you’ll need you use the -l
command line option (otherwise, due to performance considerations,
line numbers will be discarded as well).
On query/database level, there are two ways to get a direct reference:
• With fn:path, you get an XPath expression that points to your node.
• With db:node-pre [1], you get a direct reference to the node in a database.
Best,
Christian
[1]
http://docs.basex.org/wiki/Database_Module#db:node-id