BaseX 12.3: xml:id namespace lost when loading XInclude document

Monday, 27 April 2026 · 2 messages · last reply 28 Apr 2026
JR
Jonathan Robie27 Apr 2026 20:17 #
I am hitting a namespace bug when loading XInclude files with -i. I am using BaseX 12.3. Consider the following two files: main.xml:
<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="included.xml"/>
</root>
included.xml:
<?xml version="1.0"?>
<item xml:id="test123"/>
If I load main.xml with -i, the xml namespace is lost on xml:id attributes: basex -i main.xml '//item/@xml:id' This returns empty. But if I load it using doc(), it works fine: basex 'doc("main.xml")//item/@xml:id' This returns test123. My workaround is to use doc() with an external variable instead of -i. This may be related to issue #2642. Jonathan
G
grd28 Apr 2026 08:58 #
Hi Jonathan, starting with 12.0, xi:include evaluation now needs to be enabled explicitly: for database access (so when binding with "-i"), option XINCLUDE must be set, either on command line ("-OXINCLUDE") or in the configuration. The default has changed from true to false in 12.0 when using fn:doc on non-database URIs: option {'xinclude': true()} must be passed to fn:doc. This was also introduced in 12.0 Using 12.3, I was not able to reproduce the behavior that you are describing. Without setting the option, both of the following return an empty result: basex -i main.xml "//item/@xml:id" basex "doc('main.xml')//item/@xml:id But when setting option XINCLUDE or xinclude, respectively, both of these return "xml:id="test123": basex -OXINCLUDE -i main.xml "//item/@xml:id" basex "doc('main.xml', {'xinclude': true()})//item/@xml:id This matches the expected behavior in my tests. Could you double-check the version that you are using? I do not think that this is related to issue #2642. Best regards Gunther Gesendet: Montag, 27. April 2026 um 20:16
Quoted text · Jonathan Robie · 20 lines
Von: "Jonathan Robie via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> An: BaseX <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] BaseX 12.3: xml:id namespace lost when loading XInclude document I am hitting a namespace bug when loading XInclude files with -i. I am using BaseX 12.3. Consider the following two files: main.xml: <?xml version="1.0"?> <root xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="included.xml"/> </root> included.xml: <?xml version="1.0"?> <item xml:id="test123"/> If I load main.xml with -i, the xml namespace is lost on xml:id attributes: basex -i main.xml '//item/@xml:id' This returns empty. But if I load it using doc(), it works fine: basex 'doc("main.xml")//item/@xml:id' This returns test123. My workaround is to use doc() with an external variable instead of -i. This may be related to issue #2642. Jonathan

⚡Generated with XQuery