Exclude namespace declaration from result of XSL transform
I'm generating an XML document in parts using various transforms. In particular, I'm generating a header which contains all of the namespace declarations and is then prepended to the document. However, the transform doesn't know about this and thus sticks on another declaration. This wouldn't usually be a problem, but millions of these things开发者_开发问答 are generated and stored in a database, so having lots of redundant declarations floating about is rather annoying.
How do I turn off the generation of the namespace declarations? I've seen the exclude-result-prefixes
attribute, but the documentation for this states that declarations for used namespaces will be added anyway, which seems to render the option pointless.
The output of an XSLT transformation will always be well-formed (and namespace-well-formed) XML. If you want something that isn't, you're onto a loser.
I would question your design. It seems like a bad idea whose consequences you are starting to discover.
精彩评论