xlst 変換から不要な出力を除外する際に問題があります。一致などの背後にあるデフォルトのルールについては既に知っていますが、テンプレート/適用テンプレートで適切に一致を使用できません。
これを修正するのを手伝ってもらえますか?
だから私はこのように構造化されたXMLファイルを持っています:
<movies>
<movie id="0">
<title>Title</title>
<year>2007</year>
<duration>113</duration>
<country>Country</country>
<plot>Plot</plot>
<poster>img/posters/0.jpg</poster>
<genres>
<genre>Genre1</genre>
<genre>Genre2</genre>
</genres>
...
</movie>
...
</movies>
そして、ジャンル '#######' (実行時に私の perl スクリプトに置き換えられます) に属する各映画の LI を含む html UL リストを作成したいと思います。 )。
今、私はこのようにしています:
<xsl:template match="/">
<h2> List </h2>
<ul>
<xsl:apply-templates match="movie[genres/genre='#######']"/>
<li>
<a>
<xsl:attribute name="href">
/movies/<xsl:value-of select= "@id" />.html
</xsl:attribute>
<xsl:value-of select= "title"/>
</a>
</li>
</ul>
</xsl:template>
明らかに、このようにして、選択したジャンルに一致する映画のすべての要素が表示されます。<xsl:template match="...">
余分な出力をすべて削除するには、大量に追加する必要がありますか?
このような HTML スニペットを作成する正しい方法を教えてください。