埋め込まれた Xslt ファイルで同じことを達成するにはどうすればよいですか?
答え:
Microsoft の XSLT プロセッサはいずれも、組み込み XSLT スタイルシートをサポートしていません。XSLT スタイルシート用の完全な XSLT 専用ファイルが必要になります。
XSLT では、ノードを一意に識別する何らかの文字列値によってノードを効率的に選択するための<xsl:key>
命令と関数を使用します。key()
この変換:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:key name="UriSourceByKey"
match="@UriSource" use="../@x:Key"/>
<xsl:variable name="vImageFunTime"
select="key('UriSourceByKey', 'ImageFunTime')"/>
<xsl:template match="/">
<xsl:value-of select="$vImageFunTime"/>
</xsl:template>
</xsl:stylesheet>
この XML ドキュメントに適用した場合:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="ImageFunTime" UriSource="../Resources/Images/ImageFunTime.png" />
</ResourceDictionary>
必要な結果を生成します:
../Resources/Images/ImageFunTime.png