> Hah! Yes, of course. Well, I say "of course" now that
> you've pointed it out. This seems like the kind of problem
> that we'd expect to occur more widely in the XML world.
Errr no - because the XML world treats an XML document as representing
an XML tree not the textual representation i.e. parse the angle bracket
stuff into an XML tree, manipulate that tree and then render it back to
the angle bracket form rather than manipulate the textual angle bracket
directly. In which case this problem does not arise (since the namespace
nodes exist at both the definining element and all child elements).
> wonder whether there are existing guidelines to cover such
Well, the guidelines are that you use an XML parser that follows the
normal rules for handling XML namespaces in which case it doesn't matter
want form you use...
> In general, I guess the rule is that namespace
> definitions should be placed on the innermost element that
> they affect
There is a canonical XML form which is primarily used for
encryption/signing when you do want the same XML tree to generate the
same textual representation (generally an XML tree has an infinite set
of textual representations!). In canonical XML, the namespaces go into
the root element.