bryan rasmussen wrote:
unfortunately I absolutely need to have xmlns:in to show up on the
in:Invoice element (as well as a couple other namespace declarations)
if I expect this to work with Open Office (rant about Open Office /
xforms omitted for sake of not making people go insane)
You can't really control the namespace cleanup process. But I found that
the following worked for outputting a particular namespace before it is
actually used:
<root>
<elem xmlns:test="http://www.xyz.com">
<other-element-default-ns>
<test:other-ns-now>
<default-ns />
</test:other-ns-now>
</other-element-default-ns>
</elem>
</root>
Tested with Saxon 6.5, it gives:
<root>
<elem xmlns:test="http://www.xyz.com">
<other-element-default-ns>
<test:other-ns-now>
<default-ns/>
</test:other-ns-now>
</other-element-default-ns>
</elem>
</root>
This is not strictly necessary. Not sure if the processor is allowed to,
I think it is, to cleanup the namespaces the way it likes and instead
put the namespace decl. to 'test:other-ns-now' element. Putting the
namespace declaration on another element leaves it there.
Dynamically creating namespaces is not possible this way.
Not sure this is what you are after. If you add the same namespace to
the xsl:stylesheet element, it will be added to the root element of the
output. Adding exclude-result-prefixes, will trigger namespace cleanup
and will put the namespace declaration to the first element where it is
needed test:other-ns-now element. Which means, in effect, that you have
to remove all this stuff from your root xsl:stylesheet element and
declare them each time you actually need them. This will make a mess of
your code....
I am a bit puzzled that you need such control over your namespaces in
the output. The processor is not allowed to make your output
namespace-uncompliant, so, whatever you are trying, even in your current
situation, the namespace declaration will be there *before* it is
actually used, which is the way it should be in XML+NS. Do you mean that
the target system that uses your document is not XML+NS compliant and
has some specific way of dealing with it?
Cheers,
-- Abel
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--