Share via


<xsl:namespace-alias> Element

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/>

Attributes

  • stylesheet-prefix
    The prefix for the namespace URI used in the XSLT file.
  • result-prefix
    The prefix for the namespace URI used in the result tree.

Element Information

Number of occurrences

Unlimited

Parent elements

xsl:stylesheet

Child elements

(No child elements)

Remarks

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 canassign 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>.

Example

The following topic example provides an example of <xsl:namespace-alias>.