Anonymous user
Sum and product of an array: Difference between revisions
→{{header|XSLT}}: format
(→{{header|XSLT}}: format) |
|||
Line 536:
XSLT (or XPath rather) has a few built-in functions for reducing from a collection, but product is not among them. Because of referential transparency, one must resort to recursive solutions for general iterative operations upon collections. The following code represents the array by numeric values in <price> elements in the source document.
<pre><nowiki>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
Line 572 ⟶ 573:
</xsl:template>
</xsl:stylesheet>
</nowiki></pre>
|