Hi Jonathan,

starting with 12.0, xi:include evaluation now needs to be enabled explicitly:
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:
But when setting option XINCLUDE or xinclude, respectively, both of these return "xml:id="test123":
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
Von: "Jonathan Robie via BaseX-Talk" <basex-talk@mailman.uni-konstanz.de>
An: BaseX <basex-talk@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