473,382 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XSL Group by and sub totals

Hi I have the following FO XSL document with the following data

I am trying to add sub totals for each group in a XSL document but
cannnot seem to work it out!

Output would be something like:-

Area 1
--- Name 1.1
--- Name 1.2
--- Name 3.1
Sub total = 3
Area 2
--- Name 2.1
--- Name 2.2
Sub total = 2

Grand total = 5

Can anyone help?
##### BEGIN XSL DOC ######

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master master-name="first" page-height="21cm"
page-width="29.7cm" margin-top="1cm" margin-bottom="1cm"
margin-left="1.5cm" margin-right="1.5cm">
<fo:region-body margin-top="15mm" margin-left="0mm"
margin-right="0mm" margin-bottom="0mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- starts actual layout -->
<fo:page-sequence master-reference="first">
<!--start - page body-->
<fo:flow flow-name="xsl-region-body" font-size="9pt">
<!--wrapper table-->
<fo:block>
<fo:table margin-top="10mm" table-layout="fixed"
width="100%">
<fo:table-column
column-width="proportional-column-width(1)"/>
<fo:table-column
column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding="3pt"
border-bottom-style="solid" border-bottom-color="#000000"
border-bottom-width="1px">
<fo:block>LLSC</fo:block>
</fo:table-cell>
<fo:table-cell padding="3pt"
border-bottom-style="solid" border-bottom-color="#000000"
border-bottom-width="1px">
<fo:block>Nextstep site</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="Root/Data">
<fo:table-row>
<fo:table-cell padding="3pt"
border-bottom-style="solid" border-bottom-color="#EEEEEE"
border-bottom-width="1px">
<fo:block>
<xsl:value-of select=".//LLSCName"/>
</fo:block>
</fo:table-cell>
<fo:table-cell padding="3pt"
border-bottom-style="solid" border-bottom-color="#EEEEEE"
border-bottom-width="1px">
<fo:block padding-left="10mm">
<xsl:value-of select=".//NextstepName"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
<!--End - page body-->
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>

##### END XSL DOC ######
##### BEGIN XML DOC ######

<?xml version="1.0" standalone="yes"?>
<Root>
<Data>
<LLSCName>Area 1</LLSCName>
<NextstepName>Name 1.1</NextstepName>
</Data>
<Data>
<LLSCName>Area 1</LLSCName>
<NextstepName>Name 2.1</NextstepName>
</Data>
<Data>
<LLSCName>Area 1</LLSCName>
<NextstepName>Name 3.1</NextstepName>
</Data>
<Data>
<LLSCName>Area 2</LLSCName>
<NextstepName>Name 2.1</NextstepName>
</Data>
<Data>
<LLSCName>Area 2</LLSCName>
<NextstepName>Name 2.2</NextstepName>
</Data>
</Root>

##### END XML DOC ######

Mar 20 '06 #1
1 2090
Rippo wrote:
I am trying to add sub totals for each group in a XSL document but
cannnot seem to work it out!

Output would be something like:-

Area 1
--- Name 1.1
--- Name 1.2
--- Name 3.1
Sub total = 3
Area 2
--- Name 2.1
--- Name 2.2
Sub total = 2

Grand total = 5

Can anyone help?


To my mind, most Arithmetic in XSLT is a bit of a pain. It may not
apply to your case, but if your original XML is generated from
a relational database, don't forget that the database engine is
(almost certainly) able to do all this and present it to you
as a VIEW.

Much easier, in my experience.

Mar 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Galina | last post by:
Hello I have a report, which lists records. Each record has money paid field. Money paid can be 0 or not 0. I calculate and print summary of money for a group in the group footer, as well as...
3
by: Louis | last post by:
Is there a switch or a setting in Access so that a group by query doesn't return a field name SumOf(original field name)? Especially when you chain multiple queries together you'd get...
7
by: Darin | last post by:
I have a report that sub-totals on a group, then grand-totals at the report footer. If there's only one group, the sub-total and grand total are redundant, so I only want to show one of them. I...
1
by: Propoflady | last post by:
I have a form where I enter each time someone looks at a horse or our farm. When I print the report it looks like Date Person a Person b Person b Person c Person b has looked at the horse...
1
by: ruthkred | last post by:
I am grouping certain sections of data in a report but whenever the group footer lands at the top of a new page it doubles the amount it should be. For example, if there was a detail line totals...
7
by: tom_b | last post by:
Hi, I have some php scripts to use with a mysql database. I've tested them locally on my computer and they work fine, but when I put them on line I get the message "Invalid use of group...
8
by: tom_b | last post by:
Hi, I'm not really sure if this is a PHP or Mysql issue, but I need some help!! I have some php scripts to use with a mysql database. I've tested everything locally on my computer and they...
2
by: hanshirley88 | last post by:
Hi, I am doing an expense and funding report which contains a list of consumers by Region and then by SiteID. For example, Region: NE Site: NEMV 1. Mary Doe 2. Len Willams
1
by: MarStarCoda | last post by:
Hello people, I'm building an application for our company intranet and need to figure out what loop to use (if any) and how to do write the code. Heres what I have... I have 4 fields with a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.