The <xsl:namespace-alias>
element replaces the prefix associated with a given namespace with another prefix.
<xsl:namespace-alias stylesheet-prefix = NCName result-prefix = NCName/>
Number of occurrences | Unlimited |
Parent elements | xsl:stylesheet |
Child elements | (No child elements) |
Sometimes the content that an XSLT file generates is other XSLT. This presents a challenge with namespaces because there is no explicit way to declare two prefixes with the same namespace without the processor treating both prefixes as the same namespace and acting on them. With the <xsl:namespace-alias>
command, you can assign an interim namespace to an alternate prefix, apply the style sheet, and then map the alternate namespace to the XSLT one.
Although XSL-to-XSL file generation is the primary use for this command, it is not the only one. You can use this technique anywhere you have colliding namespaces (for example, with the xsi: schema data type namespace). The top-level element must be <xsl:namespace-alias>
.
The following topic example provides an example of <xsl:namespace-alias>
.