コレクション (ファイルシステム) からツリービューを生成しようとしています。残念ながら、一部のファイルには、ü ä や ö などの特殊文字が含まれています。そして、それらをHTMLとしてエンコードしたいと思いますä
変数から取得すると、URL エンコードされます。最初にそれらを UTF-8 にデコードしてから ....さらに先に進む方法がわかりません。
<li><a href="#">{util:unescape-uri($child, "UTF-8")}</a>
関数util:parse
は、私が望むものとは正反対のことをしています。
再帰関数は次のとおりです。
xquery version "3.0";
declare namespace ls="ls";
declare option exist:serialize "method=html media-type=text/html omit-xml-declaration=yes indent=yes";
declare function ls:ls($collection as xs:string, $subPath as xs:string) as element()* {
if (xmldb:collection-available($collection)) then
(
for $child in xmldb:get-child-collections($collection)
let $path := concat($collection, '/', $child)
let $sPath := concat($subPath, '/', $child)
order by $child
return
<li><a href="#">{util:unescape-uri($child, "UTF-8")}</a>
<ul>
{ls:ls($path,$sPath)}
</ul>
</li>,
for $child in xmldb:get-child-resources($collection)
let $sPath := concat($subPath, '/', $child)
order by $child
return
<li> <a href="javascript:loadPage('{$sPath}');">{util:unescape-uri($child, "UTF-8")}</a></li>
)
else ()
};
let $collection := request:get-parameter('coll', '/db/apps/ebner-online/resources/xss/xml')
return
<ul>{ls:ls($collection,"")}</ul>