XSLT SUM IF example


Thank you for taking the time to look at my question.

Essentially I have the following XSL:

and what I want to do is if account=16 and trpaymentdate > 20091231 and trpaymentdate is <=20100131 sum of all tr_toagency and sum of all tr_to_client and then sum these two figures together.

Could someone please help with how the XSLT sheet would look?  Once I see how you go about that I can then fill in what I need to.

Many thank you's in advance.
mavmanauNetwork Engineer/SysadminAsked:
Who is Participating?
zc2Connect With a Mentor Commented:
Please test the following template, I guess it's that you need
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<xsl:variable name="scope" select="/clientdemo/transaction[account = 16 and tr_payment_date &gt; 20091231 and tr_payment_date &lt;= 20100131]"/>
		<xsl:value-of select="sum($scope/tr_to_agency) + sum($scope/tr_to_client)"/>

Open in new window

mavmanauNetwork Engineer/SysadminAuthor Commented:
many thank you's I think I can work out most of what I need from there except for one more quick question that I forgot to include as part of original.  Say I am feeding in a value for clientrowid.  When the page first loads, this is of course blank, but if the user clicks on a row above this particular section and selects a particular clientrowid that is then fed into the XSLT page, how would I then make it choose to only do the ones with that particular ClientROWid...say for example it is 2??
mavmanauNetwork Engineer/SysadminAuthor Commented:
that works perfect though, the first part you have given me.
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

mavmanauNetwork Engineer/SysadminAuthor Commented:
Thank you!! very appreciative, very quickly done too!!
You welcome. So, did you figure out how to feed an input id value?
mavmanauNetwork Engineer/SysadminAuthor Commented:
i think so...I am trying at the moment!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.