not 函数 (XPath)

如果参数为 false,则返回 true;否则,返回 false。

boolean not(boolean)

示例

在该示例中,notexample.xsl 样式表应用于 books.xml 文档。 对于每个书节点,计算 <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>

ms256458.collapse_all(zh-cn,VS.120).gif格式化输出

Midnight Rain - $5.95

ms256458.collapse_all(zh-cn,VS.120).gif处理器输出

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

请参见

参考

XML 数据类型引用