The XPath default namespace is part of the static context, so it cannot be changed during execution (it's used by the compiler while generating code).

You'll have to do this by explicit predicates testing the value of namespace-uri().

I've always thought it would be quite nice to define a namespace as the union of several other namespaces so that the nametest u:name matches names in three different namespaces - and of course that union namespace could then be made the default - but there's nothing like that in the current specs, and when I've floated the idea there's been strong opposition.

Michael Kay

On 1 Aug 2013, at 16:20, wrote:


is it possible to programmatically set the xpath_default_namespace and as well have more that one xpath default namespaces ?

in fact i would like to pass as a parameter to my xsl what xpath_default_namespaces to work with and filter all others.
My use case is that with the same XSL i would like to be able to process some elements having various namespace.

In the below example i would like to get all DIO elements of the namespace n1 and n2 and in another time get all DIO of namespace n1 and n3
my input xml file
                                <n0:DIO name="a"/>
                                <n1:DIO name="b"/>                                
                                <n2:DIO name="c"/>
                                <n3:DIO name="d"/>/>

Ideally , i would like to programmatically set the default namespace and also be able to have more than one xpath default namespace
xpath_default_namespace = n1 and n2
<xsl:for-each select="//DIO">   --->  and get as a result <n1:DIO name="b"/> <n2:DIO name="c"/>

Unfortunalty i can't set several xpath_default_namespace but maybe some of you have an idea.

Thank you

Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
saxon-help mailing list archived at