0

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.

  • In the context of XML databases, usually the `doc` and `collection` functions, besides db specific modules, help, see whether http://docs.basex.org/wiki/Databases#XML_Documents gives you the options you are looking for. – Martin Honnen Mar 05 '20 at 11:02

2 Answers2

0

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

For example :

base-uri(//ITEM[@name="A"])
E.Wiest
  • 5,425
  • 2
  • 7
  • 12
0

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.