module namespace freeze-test = "http://www.architextus.com/xquery/library/how2_tests"; import module namespace app = "http://www.architextus.com/xquery/library/how2_appvars" at "How2_AppVars.xqm"; declare namespace rest="http://exquery.org/ns/restxq"; declare namespace xsl="http://www.w3.org/1999/XSL/Transform"; declare %rest:path('/test/xsl-params') %rest:GET %output:method("html") %output:html-version("5.0") function freeze-test:test(){ let $string-variable := freeze-test:get-localized-string('en-us', 'application') let $debug := file:write('debug-string-var.txt', $string-variable) let $params := map {'this-works' := 'string-value', 'test-value' := $string-variable} let $xml := let $xsl := Test

This works: .

This doesn't: .

let $result := xslt:transform($xml, $xsl, $params) return $result }; declare function freeze-test:get-localized-string($lang as xs:string, $string-name as xs:string){ let $strings := db:open($lang)/*[@id='stringreferencestransform'] return if (exists($strings/descendant::*[name()='string'][@name=$string-name])) then $strings/descendant::*[name()='string'][@name=$string-name]/node() else () };