EDIT: solved - incorrect path to the XML document. I'll leave this embarrassing question up in the hope that it may help others.
Environment: eXist-db 4.2.1 , XQuery 3.1, XSLT 2.0
I am building a webpage from a number of templates in eXist-DB, the last of which calls an XSL transformation to produce a fragment of HTML.
The XSL transformation works when I test it outside eXist-DB. At this XSLT fiddle, you have the complete XSLT file and a representative XML doc that should be transformed. It produces the expected HTML without error. Oxygen also produces the transformation without error.
Yet when I execute the transformation in eXist-db XQuery, it signals execution...but it produces no output!
The XAR file for this project (with all modules and files included) can be downloaded here: https://www.dropbox.com/s/gtg4lpv9jsh822e/deheresi-0.1.xar
This is the XQuery transform function that should produce the HTML fragment:
declare function document:doc-xsl-docview($node as node(),
$model as map(*), $currentdoc as xs:string)
{
let $currentdocnode := doc(concat($globalvar:URIdb,$currentdoc))
let $xi := concat("xinclude-path=", $globalvar:URIdb)
let $xsltdoc := doc(concat($globalvar:URIstyles,
"ms609__testxsl-withmodes.xsl"))
let $xsltransform := transform:transform(
$currentdocnode,
$xsltdoc,
(<parameters>
<param name="paramPersonurl" value="{$globalvar:URLperson}"/>
<param name="paramPlaceurl" value="{$globalvar:URLplace}"/>
<param name="paramDocurl" value="{$globalvar:URLdoc}"/>
</parameters>),(),$xi)
return $xsltransform
};
This is the HTML (in document.html
) calling the function in a template (the last template call). All the other doc-sidebar
templates execute perfectly. <div class="col-md-10 document-view">
outputs as an empty div.
<div xmlns="http://www.w3.org/1999/xhtml" data-
template="templates:surround" data-template-
with="templates/site_wrapper.html" data-template-at="content">
<div class="col-md-12 document-title">
<h2>
<span class="en">Deposition: Arnald Donat</span>
<span class="fr">Déposition : Arnald Donat</span>
</h2>
</div>
<div class="col-sm-12">
<div class="col-md-2 sidebar">
<div data-template="document:doc-sidebar-sub1" data-template-currentdoc="ms609_0013.xml"/>
<div data-template="document:doc-sidebar-sub2" data-template-currentdoc="ms609_0013.xml"/>
<div data-template="document:doc-sidebar-sub3" data-template-currentdoc="ms609_0013.xml"/>
<div data-template="document:doc-sidebar-sub4" data-template-currentdoc="ms609_0013.xml"/>
</div>
<div class="col-md-10 document-view">
<div data-template="document:doc-xsl-docview" data-template-currentdoc="ms609_0013.xml"/>
</div>
</div>
</div>
As part of my testing, I did the following: I hardcoded the expected HTML fragment into an XSL file (texthtmlonly.xsl
) and called it from the same function instead. It produces the output successfully.
At this point I can't see any reason why the XSL transformation shouldn't work:
the XSL and XML files produce valid results without error (outside eXist)
the XQuery transform produces results with a hardcoded XSL file
the HTML calls all templates without error
Many thanks in advance.
NB: the TEI-XML file (ms609_0013.xml) is temporarily hardcoded for testing in eXist-DB.
EDIT: solved - incorrect path to the XML document. I'll leave this embarrassing question up in the hope that it may help others.