Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
In fact there are five different ways that an element in the result tree can acquire namespace nodes:
So the
The namespace fixup process does not automatically create namespace nodes in respect of elements or attributes that have QName-valued content, even when there is a schema that describes the content as a QName. The reason for this is to allow namespace fixup and schema validation to operate as separate processes. Suppose that the schema defines the type of attribute
start
as being an
xs:QName
, and that you want to create the attribute
start=“my:root”
. Schema validation takes the string value of this attribute as input, checks that the namespace prefix
my
is declared, and generates firstly the typed value of this attribute (a QName consisting of the local name
root
and the namespace URI corresponding to prefix
my
), and secondly the type annotation of the attribute as an
xs:QName
. So the namespace node has to be created before schema validation takes place. This means it cannot be done by an automatic namespace fixup process, because at the time namespace fixup takes place, the attribute node has no type annotation, so you don't yet know that it's an
xs:QName
.