<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="expressions" page="conditionals" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Conditional Expressions</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: Conditional Expressions"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>Conditional Expressions</h1> <p>XPath 2.0 allows a conditional expression of the form <code>if ( E1 ) then E2 else E3</code>. For example, <code>if (@discount) then @discount else 0</code> returns the value of the <code>discount</code> attribute if it is present, or zero otherwise.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="quantified.xml">Next</a></p> </td> </tr> </table> </body> </html>