declare function local:change($node)
{
typeswitch($node)
case element(add) return
local:do-something()
default return $node
};
let $test1 := <test xmlns="http:example.com/A">
<add>x1</add>
<b>x</b>
</test>
let $test2 := <test xmlns="http:example.com/B">
<add>x1</add>
<b>x</b>
</test>
In the typeswitch when element add, doing some further processing. Code is generic. The documents that will be sent for processing will have the same elements but namespace can be different like one in the example.
How to provide the namespace dynamically in case element.