homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Using Function Sum

5+ Year Member

Msg#: 4111595 posted 5:49 pm on Apr 7, 2010 (gmt 0)

I am attempting sum a result based upon an attribute ID with the following stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:acord="http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/"

<!-- <xsl:variable name="SingleLocation" select="bpws:getVariableData('singleLocation')"/>-->
<xsl:variable name="SingleLocation">
<Location id="L26207" xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/" xmlns:p0="http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

<xsl:template match="*"><xsl:apply-templates></xsl:apply-templates></xsl:template>

<xsl:template match="acord:WorkCompLineBusiness">
<xsl:variable name="LocationId">
<xsl:value-of select="$SingleLocation/acord:Location/@id"></xsl:value-of>
<xsl:element name="EmployerLocationPayroll">
<xsl:for-each select="//acord:WorkCompRateClass">
<xsl:if test="./@LocationRef = $LocationId">
<xsl:element name="Info">
<xsl:element name="LocationPayroll">
<xsl:value-of select="sum(acord:Exposure)"/>


<xsl:template match="text()"/>


<?xml version="1.0" encoding="UTF-8"?><EmployerLocationPayroll><Info><LocationPayroll>20000</LocationPayroll></Info><Info><LocationPayroll>100000</LocationPayroll></Info></EmployerLocationPayroll>

What is the best way to sum(LocationPayroll)? I keep getting the individual values for each based upon the attribute ID and can't get the style sheet to sum the two values.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved