Andy Fish wrote:
the issue is that I don't know what namespace prefix might have been used in
the source document. in the output document I want to use the same namespace
I'm using in the stylesheet
If you copy a node from the stylesheet to the output, it will have the
same namespace, and namespace bindings, as in the stylesheet.
If you copy a node from a source document to the output, it will have
the same namespace, and namespace bindings, as in the source document.
Appropriate declarations will be generated to make it so, if the
relevant binding from prefix to namespace URI isn't already in scope at
that point in the output. They aren't "spurious"; they're required to
achieve the above semantic results.
If you're having trouble, it's because you either aren't trusting
xsl:copy to do the right thing, or because you're trying to override
those semantics, or because you're not using namespaces properly... or
because you're worried about validating against a DTD which doesn't
allow the relevant namespace declarations at that point in the document.
If it's the last, the best advice I can give you is to abandon DTDs; the
namespace spec deliberately chose not to worry about "playing nice" with
DTDs, and its authors advised everyone to switch to XML Schema -- which,
unlike DTDs, is fully namespace-aware.
It might help if you gave us a more explicit example of what you're
trying to do. You've given us a request out of context, and a fragment
of code that attempts to meet that request... but both presuppose a
particular solution, and it may not be the right solution. Consider
posting a minimal example that demonstrates what you think is a problem,
and explaining exactly why you consider it a problem. You'll get better
answers if you ask the real question rather than asking about a detail.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry