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,
-- 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>
--~--