Greetings,
I have two xqm files (located in webapp folder) and would like to define a function that could be used in both of them.
What would be the most simple approach? For example is it possible to call is it possible to call a function defined in one xqm file from another?
TIA Best regards Michel
Hello Michel,
sure. I would recommend to add all xqm files which are used by multiple files to be put into the repository, see https://docs.basex.org/wiki/Repository for more information (you can just put them into the repo/ folder, no need to use the commands).
Based on the namespace URI, BaseX will automatically search for the xqm file in the repository when importing it like that:
import module namespace mymodule = 'your-uri';
However, you do not have to do that and you can explicitly point to the xqm location:
import module namespace mymodule = 'your-uri' at '/location/to/file.xqm';
Either way, you can now use the function within the module, e.g. mymodule:mysupercoolfunction()
Cheers, Dirk
On 14/05/14 16:11, Michel Banguerski wrote:
Greetings,
I have two xqm files (located in webapp folder) and would like to define a function that could be used in both of them.
What would be the most simple approach? For example is it possible to call is it possible to call a function defined in one xqm file from another?
TIA Best regards Michel
basex-talk@mailman.uni-konstanz.de