Altova Mailing List Archives
>xsl-list Archive Home
>Recent entries
>Thread Prev - [xsl] I need to make sure that all namespace declarations get output to a particular element, not the document element
[Thread Next]
Re: [xsl] I need to make sure that all namespace declarations get output to a particular element, not the document element
To:
Date: 3/22/2007 2:40:00 PM
G. Ken Holman wrote:
False. The namespace node has been pruned away from the <root>
element so does not require a declaration. The node cannot be pruned
from a literal-result-element that needs it. Saxon places the
namespace declaration where it needs it and not anywhere higher.
<snip />
I think David's assertion is still correct ... it cannot be moved
"down" the tree ... the declaration is placed where there is a
namespace node in the result tree and your examples of pruning or not
pruning the namespace nodes impact on the presence of a namespace node
on your <root> result element.
I'm still wary of a processor moving the namespace declaration "up"
the tree ... though not incorrect (assuming they haven't confused
namespaces), I don't see how the result tree node has namespace nodes
requiring declarations ... surely they are not moved up the tree. Why
would a processor bother with the look-ahead to determine "future" use
of namespace nodes? But he is correct to say that it is not incorrect.
Hi Ken,
I did not mean that anything unexpected was happening there. I just
wanted to make a point. Apparently, when you have an RLE like this:
<root>
<elem xmlns:test="urn:test">
<bla>
<test:xyz />
</bla>
</elem>
<root>
then, when serializing, Saxon leaves that RLE precisely as-is. It does
not move the namespace declaration to the first element that needs it,
neither does it move it up the tree to the root (like you, I don't
expect it too). However, once you add this namespace to the
xsl:stylesheet (with exclude-result-prefixes), it does seem to do some
cleanup and move the namespace declaration down the tree to the moment
where it is first needed.
I think this extra level of control is nice and will help the OP. I
don't think that I am saying something that is different from what you
or David says, I only add that Saxon leaves the namespace declaration
where it is on any RLE, even when it is not needed directly on that very
RLE (unless you put that namespace to the xsl:stylesheet and/or when you
add exclude-result-prefixes)
I hope this helps.
Well, I was not the one in need of help, but thanks, it does clarify
things. Bryan, sorry if I went off-topic.
Cheers,
-- AbelDisclaimer
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

