flatten #19
Owner
```xquery
(:~
:simplify by omitting elements with only one child
:)
declare function xp:flatten($input as element()) as element() {
if (1=count($input/*)) then xp:flatten($input/*)
else element {node-name($input) }
{$input/@*,
for $child in $input/node()
return
if ($child instance of element())
then xp:flatten($child)
else $child
}
};
```
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?