Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
Choice of Prefixes in the Result Document
XSLT 2.0 has clarified the rules defining what prefixes are used in the result. This can be important; for example, if the target stylesheet contains an expression such as
system-property(“xslt:version”)
, then this will only work if the prefix
xslt
has been declared. Follow through exactly what happens when you write the stylesheet:
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”
xmlns:oxsl=“http://localhost/old.uri”>
This transformation executes just one instruction: the
xsl
, local name
stylesheet
, and namespace URI
http://www.w3.org/1999/XSL/Transform
. The literal result element has two namespace nodes, representing the prefix bindings
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”
and
xmlns:oxsl=“http://localhost/old.uri”
(we will ignore the namespace node for the
xml
namespace). The first of these is copied to the result tree, because it matches the
result-prefix
, despite the fact that it would normally be an excluded namespace. The second namespace node is not copied, because its namespace URI (
http://localhost/old.uri
) is the one referred to by the
stylesheet-prefix
attribute. So the namespace node in the result tree will map the prefix
xsl
to the namespace URI
http://www.w3.org/1999/XSL/Transform
.