Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

An example of the unary plus

File: Data.xml File: Transform.xslt <?xml version="1.0"?> <xsl:stylesheet version="2.0"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   xmlns:xs="http://www.w3.org/2001/XMLSchema">   <xsl:output method="text"/>   <xsl:template match="/">     <xsl:variable name="x" as="xs:integer" select="xs:integer(-10)"/>     <xsl:text>An example of the unary plus </xsl:text>     <xsl:text>operator:&#xA;    </xsl:text>     <xsl:value-of select="('$x =', $x, '&#xA;   +$x =', +$x)"/>   </xsl:template> </xsl:stylesheet> Output: An example of the unary plus operator:     $x = -10     +$x = -10