diff --git a/add/data/xql/getHelp.xql b/add/data/xql/getHelp.xql
index 7384991e3..4d9a2a210 100644
--- a/add/data/xql/getHelp.xql
+++ b/add/data/xql/getHelp.xql
@@ -3,53 +3,76 @@ xquery version "3.1";
: For LICENSE-Details please refer to the LICENSE file in the root directory of this repository.
:)
+
+(: IMPORTS ================================================================= :)
+
+import module namespace eutil = "http://www.edirom.de/xquery/eutil" at "../xqm/eutil.xqm";
+
+
(: NAMESPACE DECLARATIONS ================================================== :)
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
+
declare namespace request = "http://exist-db.org/xquery/request";
+
declare namespace system = "http://exist-db.org/xquery/system";
+
declare namespace transform = "http://exist-db.org/xquery/transform";
+
(: OPTION DECLARATIONS ===================================================== :)
declare option output:media-type "text/html";
+
declare option output:method "xhtml";
+
declare option output:indent "yes";
+
declare option output:omit-xml-declaration "yes";
+
(: QUERY BODY ============================================================== :)
let $lang := request:get-parameter('lang', 'en')
+
let $idPrefix := request:get-parameter('idPrefix', '')
-let $base := replace(system:get-module-load-path(), 'embedded-eXist-server', '') (:TODO:)
+let $base := eutil:get-app-collection()
+
+let $baseXslt := $base ||'/data/xslt/'
+
+let $docUri := string-join(($base,concat('help/help_', $lang, '.xml')), '/')
+
+let $contextPath :=
+ if(starts-with(document-uri($doc), '/db')) then
+ substring-after(document-uri($doc), '/db')
+ else document-uri($doc)
-let $doc := doc(concat('../../help/help_', $lang, '.xml'))
-let $contextPath := if(starts-with(document-uri($doc), '/db'))
- then substring-after(document-uri($doc), '/db')
- else document-uri($doc)
let $contextPath := substring-before($contextPath, concat('help/help_', $lang, '.xml'))
+
let $contextPath := request:get-context-path() || $contextPath
let $xsl := doc('../xslt/edirom_langReplacement.xsl')
+
let $doc :=
transform:transform($doc, $xsl,
-
+
)
let $xsl := doc('../xslt/tei/profiles/edirom-body/teiBody2HTML.xsl')
+
let $doc :=
transform:transform($doc, $xsl,
-
+
(: == passing empty value for docUri (XSLT expects xs:anyURI, but ExtJS view does not provide value) -> github#480 == :)
-
+
)
@@ -59,4 +82,3 @@ return
)
-
diff --git a/add/data/xqm/eutil.xqm b/add/data/xqm/eutil.xqm
index 1d0cf76e5..ed7605190 100644
--- a/add/data/xqm/eutil.xqm
+++ b/add/data/xqm/eutil.xqm
@@ -334,6 +334,17 @@ declare function eutil:get-app-base-url() as xs:string? {
util:log-system-out('request object does not exist; failing to compute base url')
};
+(:~
+ : Returns the xmldb-uri to the Edirom Online install directory
+ :
+ : @return xs:string absolute xmldb-uri to Edirom Online
+ :)
+declare function eutil:get-app-collection() as xs:string {
+
+ functx:substring-before-last(functx:substring-before-last(replace(system:get-module-load-path(), 'embedded-eXist-server', ''),'/'),'/')
+
+};
+
(:~
: Sorts a sequence of numeric-alpha values or nodes (e.g. 1, 1a, 1b, 2)
: This is an adaption of functx:sort-as-numeric()