declare namespace form="http://rules.labs.bt.com/form";
(: Function which tests node identity for various xpath sequences:)
declare function local:testis($needle as node(), $haystack as node()*){
if(some $hay in $haystack satisfies $hay is $needle)
then 'true'
else 'false'
};
let
(: The constructed tree :)
$input :=
All: {local:testis($input,$keepall)}
Elements and Attributes: {local:testis($input,$keepelsatts)}
Elements named: {local:testis($input,$keepelsnamed)}
Elements only: {local:testis($input,$keepelsonly)}
Elements outside namespace: {local:testis($input,$keepoutsidenamespace)}