0
votes

I have multiple XML files in a BaseX database:

enter image description here

Is there a XQuery or BaseX function to get the file name? In the example above i wanted an other query that returns DB03.xml as output.

2
In the context of XML databases, usually the doc and collection functions, besides db specific modules, help, see whether docs.basex.org/wiki/Databases#XML_Documents gives you the options you are looking for. - Martin Honnen

2 Answers

0
votes

Did you try URIs functions ? http://www.xqueryfunctions.com/xq/c0023.html#c0056

For example :

base-uri(//ITEM[@name="A"])
0
votes

In cases where base-uri(//ITEM[@name="A"]) would throw error [XQST0046] URI 'path/to/file' is invalid better use db:path(//ITEM[@name="A"]) with no such error, see: https://stackoverflow.com/a/44702662.