Eric Palmitesta wrote:
Hi
> It works. Is there a better way though? Also, what's the
> point of xdmp:node-insert-child if it can't operate on an
> argument to a function?
Yes it can, but not on constructed nodes. You can make a bit
more generic:
define function g($x as element()) as element()
{
element { node-name($x) } {
$x/text(),
$x/child::*,
$x/attribute::*,
attribute new{ "new" }
}
}
But this cannot update an element in place. For instance:
g(<root><test/></root>/test)
==> <test new="new"/>
> Why is the arg considered 'on-the-fly'? Shouldn't the
> function not care where $x came from or how it was
> constructed?
I'd like to know too the rational between this requirement.
> Bonus question: If I have an $x as element(), how can I pull
> out the element name?
name($x) ;-) (take care to understand the difference between
name() and node-name().)
Regards,
--drkm
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general