Whoops. Never mind. It works to use a path relative to the xquery file: 
doc(‘hella.xsl’). That was not working earlier, presumably because of some 
unrelated problem.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Thursday, September 22, 2016 at 1:28 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Accessing file within repository or package

I have a module packaged as a XAR and installed in the repo. In xquery I want 
to load xslt. This did not work:

<package name="http://example.com/hellaworld";
         abbrev="hella"
         version="1.0.0"
         spec="1.0"
         xmlns="http://expath.org/ns/pkg";>
  <title>Hella world functions</title>
  <dependency processor="basex"/>
  <xslt>
    <import-uri>http://example.com/hellaworld/hella.xsl</import-uri>
    <file>hella.xsl</file>
  </xslt>
  <xquery>
    <import-uri>http://example.com/hellaworld</import-uri>
    <file>hella.xq</file>
  </xquery>
</package>

Then using the import-uri with doc, e.g.:

(: within hella.xq in the package :)
xslt:transform($some, doc(‘http://example.com/hellaworld/hella.xsl’))


It does work, to use a path relative to the root of tomcat which I’m running 
basex in:

doc(‘webapps/basex/repo/http-example.com-hellaworld-1.0.0/hella/hella.xsl’)

but, I hope there is another way. How can I reference another file that is 
within the XAR package?

Kendall

Reply via email to