Re: [xsl] sum() applied to a product

Subject: Re: [xsl] sum() applied to a product
From: Brian Chrisman <brian.chrisman@xxxxxx>
Date: Wed, 30 Jun 2004 17:07:30 -0700
Mukul Gandhi wrote:

Hi Brian,
Please try -

<?xml version="1.0"?> <xsl:stylesheet

<xsl:output method="text" />

<xsl:template match="/a">
  <xsl:value-of select="(b[1]/c * b[1]/d) + (b[2]/c *
b[2]/d)" />


Thanks... looks like there's no generic way to do it with xpath 1.0 as Michael suggested.
I'm roped into perl XML::LibXSLT for this particular project, so it looks like a recursive template. :-)



--- Brian Chrisman <brian.chrisman@xxxxxx> wrote:

Uggg... I had some sloppy cut-paste issue in my last
post... this is what it should have been, with a
real subject line.  Sorry...

Okay.. I told someone I could do this in a simple
xpath expression

<?xml version="1.0"?>

Where the xpath was to return (2*4) + (3*6) = 26
I made several attempts with xpath's sum() function
(using 1.0) and couldn't get it.
I couldn't even come up with an expression that I
thought might work.. even though I tried several which I was certain
would fail (which did).

Any ideas?

__________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>

Current Thread