使用可能なXSLTは1.0です。
XMLベースのCMS(Symphony CMS)の二言語サイトで作業しており、カテゴリ名の英語版をフランス語版に置き換える必要があります。
これは私のソースXMLです。
<data>
<our-news-categories-for-list-fr>
<entry id="118">
<title-fr handle="technology">Technologie</title-fr>
</entry>
<entry id="117">
<title-fr handle="healthcare">Santé</title-fr>
</entry>
</our-news-categories-for-list-fr>
<our-news-article-fr>
<entry id="100">
<categories>
<item id="117" handle="healthcare" section-handle="our-news-categories" section-name="Our News categories">Healthcare</item>
<item id="118" handle="technology" section-handle="our-news-categories" section-name="Our News categories">Technology</item>
</categories>
<main-text-fr mode="formatted"><p>Blah blah</p></main-text-fr>
</entry>
</our-news-article-fr>
</data>
これは、私が現在フランス語版用に持っているXSLTの一部です。
<xsl:template match="data">
<xsl:apply-templates select="our-news-article-fr/entry"/>
</xsl:template>
<xsl:template match="our-news-article-fr/entry">
<xsl:if test="categories/item">
<p class="category">In:</p>
<ul class="category">
<xsl:for-each select="categories/item">
<li><a href="{/data/params/root}/{/data/params/root-page}/our-news/categorie/{@handle}/"><xsl:value-of select="."/></a></li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template match>
問題:アンカーの表示テキスト(<xsl:value-of select="."/>
)は、英語版のカテゴリタイトルを示します。
次のノードのハンドルは一致しているので(すべてのハンドルは英語です)、お互いに一致できるはずだと思います。
/data/our-news-categories-for-list-fr/entry/title-fr/@handle
(title-frノードの値はカテゴリtitleのフランス語訳です)
/data/our-news-article-fr/entry/categories/item/@handle
私はXSLTを初めて使用し、これを行う方法を見つけるのに苦労しています。
どうもありがとう。