# The [[#EXPath Packaging|EXPath Packaging]] system provides a generic mechanism for adding XQuery modules to query processors. A package is defined as a {{Code|.xar}} archive, which encapsulates one or more extension libraries.
All modules are stored in the ''repository''. The repository is a directory named {{Code|BaseXRepo}} or {{Code|repo}}, which resides in your [[Configuration#Home Directory|home directory]]. If modules have been Modules placed in this directory, there will can be no need to add locations to imported with the XQuery {{Code||import module}} statement, followed by a freely choosable prefix and the correct namespace. The following example calls a function from the FunctX module: <pre class="brush:xquery">import module namespace functx = 'http://www.functx.com';functx:capitalize-first('test')</pre> The following section will tell you how to install the module via BaseX [[commands]].
==Command Usage==
The installation will only succeed if the specified file conforms to the constraints described below. If you know that your input is valid, you may as well copy the files directly to the repository directory, or edit its contents in the repository without deleting and reinstalling them.
===Querying===
Installed packages can be addressed by importing them as ''modules''. Since we have the package repository in which all packages are located, it is sufficient to just specify the namespace URI of a module:
<pre class="brush:xquery">import module namespace functx = "http://www.functx.com";</pre>
When this statement is parsed, the query processor will check if the namespace "http://www.functx.com" is used in any of the installed packages and, if yes, will load and parse the modules. In the remaining query, you can call the parsed module functions in the standard way, e.g.:
<pre class="brush:xquery">functx:capitalize-first("test")</pre>
Package encapsulating Java archives can be imported in the same way as pure XQuery modules (see below).
===Listing===