次の方法で共有


not 関数

引数が false であれば true を返します。それ以外の場合は、false を返します。

boolean not(boolean)

この例では、notexample.xsl スタイル シートが books.xml ドキュメントに適用されます。各 book ノードで、<price> 要素の値が評価されます。この値が 10 以下である場合、<title> 要素と <price> 要素の値がブラウザに出力されます。

XML ファイル (books.xml)

<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="notexample.xsl"?>
<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>
</catalog>

XSLT ファイル (notexample.xsl)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
   <xsl:for-each select="//book[not(price &gt; 10)]">
      <xsl:value-of select="title"/> -
      $<xsl:value-of select="price"/><br/>
   </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

書式付き出力

Midnight Rain - $5.95

プロセッサ出力

<?xml version="1.0" encoding="UTF-16"?>Midnight Rain - $5.95<br />

参照

リファレンス

XML データ型リファレンス