I need to know how to use xPath’s numeric function within a style sheet to show the HTML output:
1 + 3 + 4 + 17 + 8 + 15 = 48
The style sheet needs to use numeric function, position(), and a test and conditional statement to present the HTML output.
This is the xml data:
<account>
<number>1</number>
<number>3</number>
<number>4</number>
<number>17</number>
<number>8</number>
<number>15</number>
</account>
This is all I have in my .xsl so far.. It just shows the sum 48…
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select='sum(//number)'/>
</xsl:template>
</xsl:stylesheet>
Any help would be greatly appreciated !
Thank you,
Shaun
Something like this would work…
XSLT 1.0
HTML Output
Also, if you must use
position()in the stylesheet, you could change thexsl:ifto: