スタイルシート変換言語 XSLT

<xsl:namespace-alias>の解説です。  スタイルシート変換言語 XSLTリファレンス 

<xsl:namespace-alias>

<xsl:namespace-alias 
stylesheet-prefix="prefix | #default" 
result-prefix="prefix | #default" />
xsl:namespace-aliasは、「stylesheet-prefix」属性が指定する接頭辞に 関連づけられている名前空間URI(prefix)を、「result-prefix」属性が指定す る接頭辞に関連づけられた別の名前空間URI(prefix)に置き換えることを宣言します。 (出力時に、ある名前空間を別の名前空間に接頭辞ごと置き換える事ができる、ということです。)
この2つの属性はどちらも必須属性であり、接頭辞なしのデフォルト名前空間を使 用する場合には#defaultに設定します。
以下の例はW3Cのサンプルを引用したものです。(名前空間も、axslという接頭辞も仕様書のものです) 結果を確認するために、コマンドプロンプトでXSLTスタイルシートを出力しています。 コマンドプロンプトとmsxsl.exeを使用した、XSLTスタイルシートを出力方法については xsl:comment の、 テキストファイル出力の項をご参照下さい。
zipファイル 以下のサンプルをダウンロード(ZIP圧縮)
■ aaa.xml
<?xml version="1.0"?>
<elements>
<block>p</block>
<block>h1</block>
<block>h2</block>
<block>h3</block>
<block>h4</block>
</elements>
■ bbb.xsl
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:fo="http://www.w3.org/1999/XSL/Format"
 xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">

<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>

<xsl:template match="/">
 <axsl:stylesheet>
  <xsl:apply-templates/>
 </axsl:stylesheet>
</xsl:template>

<xsl:template match="block">
 <axsl:template match="{.}">
  <fo:block><axsl:apply-templates/></fo:block>
 </axsl:template>
</xsl:template>

</xsl:stylesheet>
上記のファイル「aaa.xml」と「bbb.xsl」を同じディレクトリに置き、 コマンドラインに「 msxsl aaa.xml bbb.xsl -o ccc.xsl」 と入力して実行します。
サンプル
すると、同ディレクトリに以下のような「ccc.xsl」ファイルが生成されます。 「ccc.xsl」では、 「result-prefix」属性が指定する「接頭辞に関連づけられた別の名前空間URI」に、置き換え られたものが表示されている事を確認できます。 (※ 表示の都合上、画像が切れてしまっています。このページの上部のダウンロード用 ZIPフォルダに「ccc.xsl」も入れていますので、宜しければご覧下さい。)
サンプル
XSLT要素一覧
+ <xsl:apply-imports>
+ <xsl:apply-templates>
+ <xsl:attribute>
+ <xsl:attribute-set>
+ <xsl:call-template>
+ <xsl:comment>
+ <xsl:copy>
+ <xsl:copy-of>
+ <xsl:decimal-format>
+ <xsl:element>
+ <xsl:fallback>
+ <xsl:for-each>
+ <xsl:if>
+ <xsl:import>
+ <xsl:include>
+ <xsl:key>
+ <xsl:message>
+ <xsl:namespace-alias>
+ <xsl:number>
+ <xsl:otherwise>
+ <xsl:output>
+ <xsl:param>
+ <xsl:preserve-space>
+ <xsl:processing-instruction>
+ <xsl:sort>
+ <xsl:strip-space>
+ <xsl:stylesheet>
+ <xsl:template>
+ <xsl:text>
+ <xsl:value-of>
+ <xsl:variable>
+ <xsl:when>
+ <xsl:with-param>