[xquery-talk] Constructing namespace nodes
dlee at calldei.com
Sun Feb 6 21:21:53 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.
This is getting a bit off-thread but I believe that only holds up for the
immediate generation of the XML.
If I take an (arbitrary) XML document (generated with XQuery or otherwise)
with unused namespace declarations even if it survived the serialization of
the xquery, then pass it to 'something else' ... that 'something else' may
in fact discard the unused namespace declarations.
For example if I load the serialized XML into a Saxon TinyTree then
re-serialize it with a NamespaceReducer in the chain the unused namespace
declarations will be gone. Not to pick on Saxon, its doing perfectly and
exactly what I tell it to ... But there are other processes which do
similar things that is either not in the control of the typical user, or
My point is that from the XML perspective, "unused" namespace declarations
and "namespaces in content" are so lightly bound, if at all, that it's a
fragile representation that can disappear 'seemingly without cause' . (of
course there IS cause but it may not be either obvious or in direct control
of the user/process).
However I think this is a known issue with namespaces in general ... I'm
just hoping for some magic trick with a good deal of resiliency to
processing and representation, and to me 'unused' namespace declarations are
not resilient. Rabbits anyone ?
Is this a common cause of frustration for XSLT users (and other 'namespace
in content' processes like xproc, schematron etc. ) ? or am I hitting on a
rare corner case that few if any others care about ?
I suspect I missed out on a decade of argument and rationalization :)
David A. Lee
dlee at calldei.com
More information about the talk