Rules for Resolving Import, Invoke, and Spawn Paths In this case, the query imports the module from the filesystem instead of from the modules database. The same import statement works if you configure an App server to use the filesystem as the modules database and / as the modules root. Import module namespace hw="helloworld" at "/my/app/helloworld.xqy" Now, you can import the module in a main module or library module and call the helloworld function as follows: xquery version "1.0-ml" The inserted module has the URI /my/app/helloworld.xqy. Xdmp:eval('xdmp:document-load("/space/rest/helloworld.xqy")', (), If you configure an App Server to use Modules as the modules database and / as the modules root, then you can store the module in the modules database as follows: xquery version "1.0-ml" If you insert the module into the modules database of your App Server or save it on the filesystem under the modules root directory of your App Server, then you can import the module and call the helloworld function.įor example, suppose you save the above module to the filesystem with the pathname /my/app/helloworld.xqy. The following is a simple example of a library module: xquery version "1.0-ml" Library modules cannot be evaluated directly they are imported, either from other library modules or from main modules with an import statement. Rules for Resolving Import, Invoke, and Spawn Pathsįor details on importing XQuery library modules into XSLT stylesheets and vice-versa, see Notes on Importing Stylesheets With and Importing a Stylesheet Into an XQuery Module in the XQuery and XSLT Reference Guide.Ī library module has a namespace and is used to define functions.XQuery Library Modules and Main Modules.This chapter covers the following topics: To import XQuery into Server-Side JavaScript modules, see Using XQuery Functions and Variables in JavaScript in the JavaScript Reference Guide.
This chapter describes the two types of XQuery modules and specifies the rules for importing modules and resolving URI references. Similarly, you can import XSLT stylesheets into other stylesheets, you can import XQuery modules into XSLT stylesheets, and you can import XSLT stylesheets into XQuery modules.
You can import XQuery into other XQuery and/or Server-Side JavaScript modules. Importing XQuery Modules, XSLT Stylesheets, and Resolving Paths → Learn how MarkLogic simplifies data integrationĭatabase Documents, graphs, relational data