Compartir a través de


Función not

Devuelve un valor verdadero si el argumento es falso; en caso contrario, el resultado será un valor falso.

boolean not(boolean)

Ejemplo

En este ejemplo, la hoja de estilos notexample.xsl se aplica al documento books.xml. Para cada nodo de libro, se evalúa el valor del elemento <price>. Si no es superior a 10, el valor del elemento <title> y el valor del elemento <price> se generan en el explorador.

Archivo 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>

Archivo 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>

Resultado con formato

Midnight Rain: $5,95

Resultado del procesador

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

Vea también

Referencia

Referencia de tipos de datos XML