Redundant namespace declarations in the output tree

SAXON currently never outputs a namespace declaration unless there is an
element or attribute name that uses it.

My understanding of the latest spec is that on a literal result element I am
required to output redundant namespace declarations (unless they are
suppressed using xsl:exclude-result-prefixes), while on elements written
using xsl:element I am allowed to output redundant namespace declarations,
but am not required to do so: and further, there is no way for the user to
control whether I do so or not, except by the global exclude-result-prefixes
on xsl:stylesheet. Is this correct?

Reading xsl:copy again I see this also says that when copying an element
node I should output all its namespace nodes including those that might only
be needed for attributes that are not copied, and again there seems to be no
way for the user to suppress it except at the stylesheet level. 

I can see why it might sometimes make sense to output redundant namespace
declarations (e.g. when the result document is a stylesheet) but I can't see
why the three cases are different.

Futher, for a literal result element, the spec says that all attributes
except those in the XSLT namespace are copied, and that all namespaces
except those in the XSLT and extension element namespaces are copied. This
means that if there is an attribute that uses an extension element prefix,
the attribute is copied but its namespace is not. This must be wrong.


Mike Kay

Received on Thursday, 4 November 1999 14:08:58 UTC