Skip to content

Instantly share code, notes, and snippets.

@telic
Last active February 8, 2017 03:42
Show Gist options
  • Save telic/2dfe3d4f84f2efd23bfb3277f73a3379 to your computer and use it in GitHub Desktop.
Save telic/2dfe3d4f84f2efd23bfb3277f73a3379 to your computer and use it in GitHub Desktop.
Display `map(*)` contents in eXide
declare function local:display-map($m as map(*)?) as element()? {
if (exists($m)) then
<map>{
for $k in map:keys($m) return
<key name="{$k}">{
for $v in $m($k) return
typeswitch ($v)
case document-node() return <document uri="{document-uri($v)}"/>
case attribute() return <attribute name="{name($v)}">{xs:string($v)}</attribute>
case map(*) return local:display-map($v)
default return $v
}</key>
}
</map>
else ()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment