XSLT <xsl: namespace-alias> element
Definition and Usage
<Xsl: namespace-alias> element is used to replace the style sheet namespace output in a different namespace.
Note: <xsl: namespace-alias> element is the top (top-level element), and must be <xsl: stylesheet> or <xsl: transform> child node.
grammar
<xsl:namespace-alias
stylesheet-prefix="prefix|#default"
result-prefix="prefix|#default"/>
stylesheet-prefix="prefix|#default"
result-prefix="prefix|#default"/>
Attributes
属性 | 值 | 描述 |
---|---|---|
stylesheet-prefix | prefix #default |
必需。规定您希望更改的命名空间。 |
result-prefix | prefix #default |
必需。为输出规定期望的命名空间。 |
Example 1
Wxsl prefix in the output is converted to the prefix xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wxsl="http://www.w3cschool.cc/w3style.xsl">
<xsl:namespace-alias stylesheet-prefix="wxsl" result-prefix="xsl"/>
<xsl:template match="/">
<wxsl:stylesheet>
<xsl:apply-templates/>
</wxsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wxsl="http://www.w3cschool.cc/w3style.xsl">
<xsl:namespace-alias stylesheet-prefix="wxsl" result-prefix="xsl"/>
<xsl:template match="/">
<wxsl:stylesheet>
<xsl:apply-templates/>
</wxsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
Complete XSLT Element Reference Manual