[xquery-talk] Constructing namespace nodes

Michael Kay mike at saxonica.com
Mon Feb 7 00:57:33 PST 2011


> So for this particular case I believe I need a concrete node (element or
> attribute) which holds onto a reference to these namespaces so they don't
> get discarded.

It shouldn't be necessary: if you choose the right options in the query 
prolog, namespaces should not be discarded.

> But this leads to another question . I should probably post this to xsl-list
> but I am shy about cross-posting mid-thread so I'll ask it here first.
> Is there some variation in XSLT to<xsl:namespace>  which declares namespaces
> for use by match expressions ?
> I'm already making use of the xpath-default-namespace   but tried to use
> <xsl:namespace>  to declare non default prefixes and of course it didn't
> work.  The documentation is clear that this only affects serialization, not
> xpath or match expressions.

xsl:namespace creates namespace declarations in the result tree - it has 
no effect on the interpretation of namespaces in the stylesheet. For 
that you use standard XML namespace declarations, xmlns:prefix="uri", 
which can appear on any element that is an ancestor-or-self of the 
element containing the match or select attribute where the prefix is used.

Michael Kay
Saxonica


More information about the talk mailing list