-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
@dariok commented on Jul 27, 2018, 4:55 PM UTC:
What is the problem
- The templating system is used to provide the basic HTML for displaying the result of an XSL transformation:
<html data-template="wdb:getEE">
<head><title>test</title></head>
<body>
<div id="wdbContent" data-template="wdb:getContent" />
</body>
</html>
- the function to apply the transformation is basically this:
declare function wdb:getContent($node as node(), $model as map(*)) {
let $re :=
try { transform:transform(doc($file), doc($xslt), $params, $attr, "expand-xincludes=no") }
catch * { <h1>Error</h1> }
return
<div id="wdbContent">
{$re}
</div>
};- this works fine if there are no errors in the XSLT. However, if there is an error, e.g. calling
doc()on a file that does not exist, the output is an empty file:
<!DOCTYPE html>
<html></html>
What did you expect
The output of the given HTML in case of an error.
additional observations:
- calling
wdb:getContentwith exactly the same parameters from eXide produces the expected output in case of an error - everything else inside the
catchis processed correctly – I tried toconsole:logbefore returning output, which worked, and forwarding handling to another function: there, too,console:logworked but no output was produced - using
transform:stream-transformreturns the expected output in case of an error (but of course won't work correctly with the templating system)
Describe how to reproduce or add a test
The attached .zip contains an example. Store in /db/apps and call $server/exist/apps/catch/view.html.
If the line with doc() is commented out in the XSLT, you get “Testing”; if it is active, you get an empty response. If you use stream-transform instead of transform in app.xql, you get “error“ if the doc() line is active.
catch.zip
Context information
Please always add the following information
- eXist-db: 4.3.0
- Java version: 1.8.0_171
- Operating system: tested on Ubuntu 16.04 and Windows 10
- 64 bit
- How is eXist-db installed? JAR installer
- Any custom changes in e.g. conf.xml: added an additional
roottocontroller-config.xmlon the Ubuntu machine; this is not present under Windows.
This issue was moved by duncdrum from eXist-db/exist#2074.