[xquery-talk] Constructing namespace nodes

David Lee dlee at calldei.com
Sun Feb 6 18:15:47 PST 2011


Thanks for this workaround . I was about to employ it when I realized that
in a practical sense it wont work (for me).
That is, this is back to the problem of namespace declarations in elements
which are unused, but namespace references in content.
Once I plug such a document through many standard XML tools (Say Saxon and
use a NamespaceReducer) these unused namespace declarations vanish into thin
bits whence they came never to be reconstituted.

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.  I'm beginning to appreciate more and more why there is such
controversy about namespaces.

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.
So I am wondering is there an explicit xslt construct to declare
namespace/prefix mapping to be used in xpath and match expressions besides
declaring them on the root element ? 


----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org

From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Michael Kay
Sent: Sunday, February 06, 2011 2:36 PM
To: talk at x-query.com
Subject: Re: [xquery-talk] Constructing namespace nodes

On 06/02/2011 17:59, David Lee wrote: 
I am fairly sure I have answered my own question, but I still can't believe
it.


There's a workaround described here:

http://fgeorges.blogspot.com/2006/08/add-namespace-node-to-element-in.html

(It's not that dissimilar from the workaround you have to use in XSLT 1.0.)

Michael Kay
Saxonica



More information about the talk mailing list