Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 3078

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="xsl-elements" page="choose" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:choose</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:choose"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>xsl:choose</h1>
      <p>The <code>xsl:choose</code> element is used to choose one of a number of alternative outputs. The element
typically contains a number of <a class="bodylink" href="../xsl-elements/when.xml">xsl:when</a> elements, each with a separate test condition. The first
<code>xsl:when</code> element whose condition matches the current element in the source document is expanded, the others
are ignored. If none of the conditions is satisfied, the <a class="bodylink" href="../xsl-elements/otherwise.xml">xsl:otherwise</a> child element, if any, is
expanded.</p>
      <p>The test condition in the <code>xsl:when</code> element is a boolean expression.
The full syntax of expressions is outlined in <a class="bodylink" href="../expressions/intro.xml">XPath Expression Syntax</a>.</p>
      <p>Example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
&lt;xsl:choose&gt;
    &lt;xsl:when test="@cat='F'"&gt;Fiction&lt;/xsl:when&gt;
    &lt;xsl:when test="@cat='C'"&gt;Crime&lt;/xsl:when&gt;
    &lt;xsl:when test="@cat='R'"&gt;Reference&lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;General&lt;/xsl:otherwise&gt;
&lt;/xsl:choose&gt;
</code>
         </pre>
      </div>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="comment.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>