Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
With XML Namespaces 1.1, it is also possible to cancel declarations of non-default namespaces, using an attribute of the form
xmlns:prefix = “”
. This undeclaration, if supported by the XSLT processor, ensures that the literal result element will not have a namespace node for that namespace prefix.
In the result tree, the element created from the literal result element is guaranteed to have a namespace node for every namespace node that was present on the literal result element in the stylesheet, except the following:
These exceptions don't apply if the name of the element, or the name of one of its attributes, actually uses one of these namespaces. The system will always ensure that the namespaces used for the element and attributes in the result tree are declared, however hard you try to prevent it. If this isn't what you want, then the chances are you should be generating the element in a different namespace to start with. To achieve this, you might need to use the
Consider the following stylesheet:
version=“2.0”
xmlns:Date=“java:java.util.Date”
>
There are three namespaces in scope for the
java:java.util.Date
, and the default namespace
urn:acme-com:gregorian
. The XSLT namespace is not copied to the result tree, but the other two are. So, the
java:java.util.Date
, and
urn:acme-com:gregorian
.
This stylesheet uses two extension functions
Date:new()
and
Date:toString()
. This means that it will not be portable between different XSLT processors.