<html>
<head>
<title>boolean() ֐</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">boolean() ֐</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
p[^u[lɕϊ܂B </td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">
<p>IuWFNgBIuWFNg̓u[lɕϊ܂B̕ϊɂẮÃTuZNVŐ܂B </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">o</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>̓IuWFNgɑΉu[lBIuWFNĝ͎悤Ƀu[lɕϊ܂B</p>
<ul>
<dd>ĺA[Ã[A܂ <span class="LITERAL">NaN</span> (lłȂl) łȂꍇɁA<span class="LITERAL">true</span> ɂȂ܂B</p>
        </li>
<dd>m[hZbǵAłȂꍇ <span class="LITERAL">true</span> ɂȂ܂B</p>
        </li>
<dd>́A 0 傫ꍇ <span class="LITERAL">true</span> ɂȂ܂B</p>
        </li>
<dd>ׂ̑Ẵf[^^Cv́Ãf[^^CvɌŗL̕@ŕϊ܂B</p>
        </li>
      </ul>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">`</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XPath 4.3 ߁uBoolean Functionsv</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">
<p>̗ł́A܂܂ȃp[^^Cvɑ΂ <span class="LITERAL">boolean()</span> ֐Ăяoʂ܂B XML hLĝ͎ƂłB</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;test&gt;
&lt;p&gt;This is a test XML document used by several 
of our sample stylesheets.&lt;/p&gt;
&lt;question&gt;
&lt;text&gt;When completed, the Eiffel Tower was the 
tallest building in the world.&lt;/text&gt;
&lt;true&gt;Yes!  The Eiffel Tower was the world's 
tallest building until 1932, when
New York's Empire State Building opened. &lt;/true&gt;
&lt;false&gt;No, the Eiffel Tower was the world's tallest 
building for over 30 years.&lt;/false&gt;
&lt;/question&gt;
&lt;/test&gt;</pre></span>
<p>̃X^CV[ggpẴhLg܂B</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

  &lt;xsl:output method="text"/&gt;

  &lt;xsl:variable name="newline"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
  &lt;/xsl:variable&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;Tests of the boolean() function:&lt;/xsl:text&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean(true())"&gt;
        &lt;xsl:text&gt;   "boolean(true())"   returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean(true())"   returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean(true)"&gt;
<!--<?troff .Nd 10?>-->
        &lt;xsl:text&gt;   "boolean(true)"     returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean(true)"     returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean('false')"&gt;
        &lt;xsl:text&gt;   "boolean('false')"  returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean('false')"  returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean('7')"&gt;
        &lt;xsl:text&gt;   "boolean('7')"      returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean('7')"      returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean(/true)"&gt;
        &lt;xsl:text&gt;   "boolean(/true)"    returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean(/true)"    returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="boolean(//true)"&gt;
        &lt;xsl:text&gt;   "boolean(//true)"   returned true!&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;   "boolean(//true)"   returned false!&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<p>ʂ͎̂ƂłB</p>
<span class="PROGRAMLISTING"><pre>

Tests of the boolean() function:

   "boolean(true())"   returned true!
   "boolean(true)"     returned false!
   "boolean('false')"  returned true!
   "boolean('7')"      returned true!
   "boolean(/true)"    returned false!
   "boolean(//true)"   returned true!
</pre></span>
<p>̗̑ႨяڍׂɂẮA<link linkend="xslt-CHP-4"> 4 </link> <link linkend="xslt-CHP-4-SECT-2.1.2">4.2.1.2 </link>QƂĂB</p>
</td>
</tr>
</table>
</div>
</body>
</html>
