Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

subtotal in xslt?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

summaryreport.xsl


//template for row1




The requirement is that subtotals need to be added for each group(group's atrriute is partnerid in summaryReport) in my summary report.
The object(summaryReport) are splitted into row1 and row2 respectively to fullfill our requirements.

Ex: summary report -record 1
partnerid=1;
totalpayment=10.00;
badpayment=20.00;
goodpayment=10.00;
avgpayment=10.00;
minpayment=20.00;
maxpayment=10.00;

summary report -record 2
partnerid=1;
totalpayment=10.00;
badpayment=30.00;
goodpayment=10.00;
avgpayment=40.00;
minpayment=20.00;
maxpayment=10.00;

summary report -record 3
partnerid=3;
totalpayment=10.00;
badpayment=20.00;
goodpayment=10.00;
avgpayment=10.00;
minpayment=20.00;
maxpayment=10.00;

Let's assume I have three records in summaryreport list.when the list is iterating in for-each loop, i have to check the current record's partnerid with next's
partnerid and do the summation(ie:subtotal) for each attribute in summary report till partner id is 1 and displays subtotal at end of each group.similarly i have to do for other group as well.
As i am new to this xsl, i am bit struggling to implement the above scenario.


1) How to compare the first and record object in for-each based on group(partner-id)?
2) how to do the summation for each group(partnerid)attributes?

 
Marshal
Posts: 25969
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I edited your post to use the "code" tags to delimit code instead of the "bold" tags. Notice how it makes the code more readable and prevents your XSLT elements from being converted to smilies? Much easier to read.

As for your question, if you google "xslt grouping" the first link you get is this one: http://www.jenitennison.com/xslt/grouping/.

Your alternative is to use XSLT 2.0, which has new elements for grouping built into the language, but you would have to use a transformer which supported XSLT 2.0 if you chose that option.
 
arulraj michealraj
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul.. Thanks for your help..... I am using XSL1.0. Acutually i cannot change the version to 2.0,as there are so- many xsl files depdend on 1.0.
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic