← Prev in month ← Prev in thread

xquery can't find xinclude elements?

From
trubliphone <>
To
Date
2011-01-19T08:41:58Z
ID
<>
Thread
xquery can't find xinclude elements?
Hello.

I am having some trouble with a bit of XQuery - I think that my use of XInclude is the culprit. 

I have an XML file stored in eXist which uses XInclude to include other bits of XML:

myFile.xml:

<myFile xmlns:xi="http://www.w3.org/2001/XInclude">
  <a>
    <xi:include href="myOtherFile.xml" xpointer="xpointer(//d)"/>
  </a>
  <b>
    <foo/>
  </b>
</myFile>

myOtherFile.xml:

<myOtherFile>
  <c>
    <foo/>
  </c>
  <d>
    <foo/>
  </d>
</myOtherFile>

I try to access this using some XQuery code:

let $foo := doc('myFile.xml')//foo[parent::b]

But this doesn't return anything.

However, if I write an expression which only accesses the explicit content of myFile.xml and not the included content from myOtherFile.xml:

let $foo := doc('myFile.xml')//foo[parent::a]

This returns <foo/> as expected.

Does anybody know what I'm doing wrong?

Many thanks for your help.

← Prev in month ← Prev in thread