Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: Brian Chrisman <brian.chrisman@------>
To:
Date: 6/30/2004 10:08:00 AM
Mukul Gandhi wrote:



Hi Brian,
Please try -

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

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

version="1.0">



<xsl:output method="text" /> 



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

</xsl:stylesheet>



 



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. :-)



thanks,
Brian

Regards,
Mukul

--- 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"?>
<a>
 <b>
   <c>2</c>
   <d>4</d>
 </b>
 <b>
   <c>3</c>
   <d>6</d>
 </b>
</a>

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!
http://promotions.yahoo.com/new_mail

--+------------------------------------------------------------------

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/

or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>

--+--


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent