<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="expressions" page="arithmetic" subpage="unary"/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Unary plus and minus</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: Unary plus and minus"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>Unary plus and minus</h1> <p>The unary minus operator changes the sign of a number. For example <code>-1</code> is minus one, and <code>-0e0</code> is the double value negative zero.</p> <p>Unary plus has very little effect: the value of <code>+1</code> is the same as the value of <code>1</code>. It does, however, provide a quick way of forcing untyped values to be numeric, for example you can write <code><xsl:sort select="+@price"/></code> to force a numeric sort, if you find <code><xsl:sort select="number(@price)"/></code> too verbose for your tastes.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="multiplication.xml">Next</a></p> </td> </tr> </table> </body> </html>