[oXygen-user] eXist-db in <oXygen/>?
David Birnbaum
djbpitt at gmail.com
Sun Dec 29 09:58:19 CST 2019
Dear oxygen-user list,
I've constructed an XQuery script for eXist-db that uses the function
request:get-parameter(). It works as expected in eXide. I have established
a data source connection between <oXygen/> (XML Editor 21.1, build
2019120214, running on MacOS Mojave) and eXist-db (5.0.0) running on
localhost, and I can open, edit, and save XQuery scripts from inside
eXist-db within <oXygen/>, from which I conclude that the connection is
live. Since <oXygen/> apparently cannot use the eXist-db data source
connection for debugging, instead of using the <oXygen/> XQuery debugger
perspective to run the script I configured a transformation scenario where
I specify the localhost eXist-db connection as the Transformer. When I run
this script, I get the following error message from <oXygen/>:
err:XPDY0002 Variable $request is not bound to an Java object
The function is used in a line that reads:
declare variable $story_id as xs:string := request:get-parameter('story',
'x');
I thought at first that the error might be because the "request:" namespace
prefix was not declared and bound (eXist-db declares it implicitly), so I
added an explicit namespace declaration for it:
declare namespace request="http://exist-db.org/xquery/request";
The error remains. The entire XQuery script is below; it retrieves
information from a TEI document, based on a user-supplied resource name, if
the document exists and returns an error message otherwise.
Can someone please help me identify what I have apparently misunderstood
about running XQuery scripts in an <oXygen/> transformation scenario using
eXist-db as the XQuery transformer?
Sincerely,
David
djbpitt at gmail.com
__
xquery version "3.1";
declare default element namespace "http://www.tei-c.org/ns/1.0";
declare namespace request="http://exist-db.org/xquery/request";
declare variable $stories as document-node()+ :=
collection('/db/apps/neh_06_reading_tei/xml');
declare variable $story_id as xs:string := request:get-parameter('story',
'x');
declare variable $story_filename as xs:string: = concat($story_id, '.xml');
declare variable $story as document-node()? :=
$stories[ends-with(base-uri(), $story_filename)];
if ($story) then
<TEI>{
$story//(titleStmt/title | text)
}</TEI>
else
<error xmlns="">{concat('No such story:', $story_id)}</error>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20191229/f71fb8b4/attachment.html>
More information about the oXygen-user
mailing list