Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
xquery version "1.0-ml";
declare variable $stuff :=
<doc>
<content>
<change-me my-attr="look at me">some text</change-me>
<count>1</count>
<name>Fred Smith</name>
</content>
</doc>;
declare function local:change($node)
{
typeswitch($node)
case element() return
element { fn:node-name($node) } {
$node/@*,
$node/node() ! local:change(.)
}
default return $node
};
local:change($stuff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment