I prefer using a RESTXQ service that exposes exactly what you want and only that. By default like this you need no password but you should check that you don't open up your documents to the world if this is an issue for you.
Just don't try that with BaseX < 8.6.4. It just locks up.
You could also pass the documents as parameters. It think that is pretty efficient.
Best regards
Omar Siam
Am 24.11.2017 um 16:24 schrieb Oliver.Zmorek@degruyter.com:
Dear all,
currently I’m facing following problem:
1)Saxon9he.jar stored in “lib” folder (to ensure XSLT 2.0) of a local BaseX instance (Windows)
2)Xquery calls a transformation xslt:transform($doc, $xsl)
3)Within this stylesheet I try to address another resource stored in the same database
Background: XML contains product information and refers to certain other XML resources like authors, serials etc.
I guess I have to options:
1)Refer to document directly (database path)
Here I used doc() and referred to the additional documents, e.g. doc(‘/serials/serial-123.xml’). Unfortunately, the transformation says that the file or directory does not exist.
I played a while around with doc() and collection() but could not find a way to make it work. Maybe the reason is that saxon runs outside the database and does not know about the database context.
2)Use rest service
Afterwards I tried to use the rest interface. Given the example before I used http://admin:admin@localhost:8984/rest/serials/serial-123.xml (user and pw are admin).
Checked that simple with a browser – worked. The transformation instead didn’t work – it returned a 401 unauthorized http response.
So, my question is how to read in database documents in an XSL stylesheet? And why does my http request does not work?
Best,
Oliver