XQuery Declaration

Send to friend

When trying to run the following simple query works in eXist.


xquery version "1.0";
                for $i in (//foo)
                where $i/foo1[text() = "5.2.3.5"]
                return
<xhtml:html>
  <xhtml:body>
        <xhtml:h1>{$i/foo3}</xhtml:h1>
   </xhtml:body>
</xhtml:html>

Running the same query in MarkLogic gives the following error:

500 Internal Server Error

XDMP-CONTEXT: (err:XPDY0002) Expression depends on the context where none is defined in /Requirements/test2.xqy, on line 8 [1.0]

How to Fix

This problem has a simple fix. Change the XQuery declaration to:

xquery version "1.0-ml";