@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:getContent with exactly the same parameters from eXide produces the expected output in case of an error
- everything else inside the
catch is processed correctly – I tried to console:log before returning output, which worked, and forwarding handling to another function: there, too, console:log worked but no output was produced
- using
transform:stream-transform returns 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
root to controller-config.xml on the Ubuntu machine; this is not present under Windows.
This issue was moved by duncdrum from eXist-db/exist#2074.
@dariok commented on Jul 27, 2018, 4:55 PM UTC:
What is the problem
doc()on a file that does not exist, the output is an empty file:What did you expect
The output of the given HTML in case of an error.
additional observations:
wdb:getContentwith exactly the same parameters from eXide produces the expected output in case of an errorcatchis processed correctly – I tried toconsole:logbefore returning output, which worked, and forwarding handling to another function: there, too,console:logworked but no output was producedtransform: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/appsand 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 usestream-transforminstead oftransformin app.xql, you get “error“ if thedoc()line is active.catch.zip
Context information
Please always add the following information
roottocontroller-config.xmlon the Ubuntu machine; this is not present under Windows.This issue was moved by duncdrum from eXist-db/exist#2074.