Math calculation
File: Data.xml
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<test>
<xsl:variable name="myVar">10</xsl:variable>
A.
<atvtest at1="hello world" />
B.
<atvtest at1="3+2+$myVar" />
C.
<atvtest at1="{3+2+$myVar}" />
D.
<atvtest at1="u{3+2}" />
E.
<atvtest at1="yo, substring('hello world',7)" />
F.
<atvtest at1="yo, {substring('hello world',7)}" />
</test>
</xsl:template>
</xsl:stylesheet>
File: Transform.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<test>
<xsl:variable name="myVar">10</xsl:variable>
A.
<atvtest at1="hello world" />
B.
<atvtest at1="3+2+$myVar" />
C.
<atvtest at1="{3+2+$myVar}" />
D.
<atvtest at1="u{3+2}" />
E.
<atvtest at1="yo, substring('hello world',7)" />
F.
<atvtest at1="yo, {substring('hello world',7)}" />
</test>
</xsl:template>
</xsl:stylesheet>
Output:
<test>
A.
<atvtest at1="hello world"/>
B.
<atvtest at1="3+2+$myVar"/>
C.
<atvtest at1="15"/>
D.
<atvtest at1="u5"/>
E.
<atvtest at1="yo, substring('hello world',7)"/>
F.
<atvtest at1="yo, world"/></test>
Related examples in the same category