XSLT » Elements » xsl:namespace-alias


The xsl:namespace-alias element is used to replace a namespace (prefix) in a stylesheet with a different namespace (prefix) for use in the output. There must be one xsl:namespace-alias element for each namespace you wish to change. In general, the primary use for this element is to convert non-XSLT elements (literal result elements) into XSLT elements for display in the output. The literal result elements are said to be mapped to the XSLT namespace.

A xsl:namespace-alias element can only be a child of the xsl:stylesheet or the xsl:transform elements.
This is a self-closing element and it cannot contain any child elements or any content.


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:guru="guru.xsl">
<xsl:param name="var">name</xsl:param>
<xsl:param name="blank"></xsl:param>
<xsl:namespace-alias stylesheet-prefix="guru" result-prefix="xsl" />
<xsl:template match="/">
<guru:stylesheet version="1.0">
<guru:variable name="{$var}">
<guru:value-of select="{$blank}" />
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="name" />

This stylesheet generates a very simple stylesheet where the guru prefix is converted to the xsl prefix. This is the code for xslt_example_namespacealias.xsl.

Language(s): XSLT

See Also: