XSLTでIF
というデモを行います。
id
がnode id
に一致する場合は、text
を印刷したいと思います。私はここからドキュメントをお読みください。IF条件がXSLTで予期しない結果をもたらすのはなぜですか?
https://msdn.microsoft.com/en-us/library/ms256209(v=vs.110).aspx
私はxsl:if
構文を使用しました。しかし、それは<p>
タグ値を印刷していません。
これはXSLTTransform for my problemへのリンクです。私はjjj
書籍ID番号 'BK101' を見せたい
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with
XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen of the
world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology society
in England, the young survivors lay the foundation for a new
society.</description>
</book>
</catalog>
:
は、そして、これは私のXMLファイルです。
そして、これは私のXSLTコードです:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="book">
<xsl:if test="@id =bk101">
<p>jjj</p>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
しかし、期待どおりに動作していません。
条件付きで申請できますか? – user5711656
もちろんif-conditionを適用することができます。しかし、述語は短くなります。必要に応じて、述語を ''に転送することができます。 ' 'のようになります。しかし、それを使用して複雑にしているのは何ですか? –
zx485
jjj
私の例で同じシンテックスを使用していて、なぜ動作していないのでしょうか? – user5711656