<div dir="ltr">Hi David,<div><br></div><div>Let me quote from Adam Retter's response to a similar question on exist-open[^1]:</div><div><br></div><div>> The issue you have is that the Request object only makes sense when your XQuery is run by eXist-db's webserver, this is because the "request" is the incoming HTTP request. When running via oxygen there is no HTTP request.</div><div><br></div><div>The same factor affects other utilities that talk to eXist via XML-RPC, such as the Java Admin Client.  makes sense, because the oXygen data source connection that is responsible for executing eXist queries uses the XML-RPC protocol.  See the attached screenshot.</div><div><br></div><div>In the same thread, Roy Walter suggested a workaround: using the 3-parameter variant of the request:get-parameter function, in which the 3rd parameter instructs the function whether to fail on error or not.[^2]  If you change your use of the function to:</div><div><br></div><div>```</div><div>request:get-parameter('story', 'x', false());<br></div><div>```</div><div><br></div><div>... then the function will return "x" when it otherwise would raise an error.</div><div><br></div><div>Best,</div><div>Joe</div><div><br></div><div>[^1]: <a href="https://markmail.org/message/afds3uvbbouees7a" target="_blank">https://markmail.org/message/afds3uvbbouees7a</a></div><div>[^2]: <a href="https://markmail.org/message/offwjsqd46fcofqc">https://markmail.org/message/offwjsqd46fcofqc</a> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 29, 2019 at 10:58 AM David Birnbaum <<a href="mailto:djbpitt@gmail.com" target="_blank">djbpitt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear oxygen-user list,<div><br></div><div>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/>:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>err:XPDY0002 Variable $request is not bound to an Java object</div></blockquote><div><br></div><div>The function is used in a line that reads:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>declare variable $story_id as xs:string := request:get-parameter('story', 'x');</div></blockquote><div><br></div><div>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:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>declare namespace request="<a href="http://exist-db.org/xquery/request" target="_blank">http://exist-db.org/xquery/request</a>";</div></blockquote><div><br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>Sincerely,</div><div><br></div><div>David</div><div><a href="mailto:djbpitt@gmail.com" target="_blank">djbpitt@gmail.com</a></div><div>__</div><div><br></div><div>xquery version "3.1";<br>declare default element namespace "<a href="http://www.tei-c.org/ns/1.0" target="_blank">http://www.tei-c.org/ns/1.0</a>";<br>declare namespace request="<a href="http://exist-db.org/xquery/request" target="_blank">http://exist-db.org/xquery/request</a>";<br>declare variable $stories as document-node()+ := collection('/db/apps/neh_06_reading_tei/xml');<br>declare variable $story_id as xs:string := request:get-parameter('story', 'x');<br>declare variable $story_filename as xs:string: = concat($story_id, '.xml');<br>declare variable $story as document-node()? := $stories[ends-with(base-uri(), $story_filename)];<br>      <br>if ($story) then<br>    <TEI>{<br>        $story//(titleStmt/title | text)<br>    }</TEI><br>else<br>    <error xmlns="">{concat('No such story:', $story_id)}</error><br></div><div><br></div></div>
_______________________________________________<br>
oXygen-user mailing list<br>
<a href="mailto:oXygen-user@oxygenxml.com" target="_blank">oXygen-user@oxygenxml.com</a><br>
<a href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user" rel="noreferrer" target="_blank">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a><br>
</blockquote></div>