SUM , GROUPING and SUBGROUPING
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Fri May 27, 2005 4:59 pm
- Contact:
SUM , GROUPING and SUBGROUPING
Hi, I have an XML doc and I have written a stylesheet to render it to pdf using fop. The stylesheets sums the total before the end of the page but the GROUPING is not achieved. I am
Here's my xml :
<ResultSet>
<row>
<LOB_NM><![CDATA[Commercial]]></LOB_NM>
<PIPELINE_NAME>GCI Profit Rpt</PIPELINE_NAME>
<ID><![CDATA[45]]></ID>
<PID><![CDATA[11]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>Marketing</PIPELINE_NAME>
<PID><![CDATA[10]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>golf</PIPELINE_NAME>
<ID><![CDATA[12]]></ID>
<PID><![CDATA[23]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>ss1</PIPELINE_NAME>
<ID><![CDATA[12]]></ID>
<PID><![CDATA[12]]></PID>
</row>
<row>
<LOB_NM>Commercial</LOB_NM>
<PIPELINE_NAME>Industry Focus</PIPELINE_NAME>
<ID><![CDATA[10]]></ID>
<PID><![CDATA[25]]></PID>
</row>
</ResultSet>
This is the way I want my final output to appear :
CIB Marketing Contact 10
CIB golf 12 23
CIB ss1 12 12
____________________________________________
CIB Totals 24 45
--Page Break
Commercial GCI Profit Rpt 45 11
Commercial Industry Focus 10 25
____________________________________________
Commecial Totals 55 36
--Page Break
This is my stylesheet :
<?xml version="1.0"?>
<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">
<fo:layout-master-set>
<fo:simple-page-master master-name="Landscape" page-height="9in"
page-width="15in" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="3cm" />
<fo:region-after extent="3cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Landscape">
<fo:static-content flow-name="xsl-region-after">
<fo:table>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:retrieve-marker retrieve-class-name="subtotalname"
retrieve-boundary="page"
retrieve-position="last-starting-within-page"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align-last="end">
<fo:retrieve-marker retrieve-class-name="subtotalvalue"
retrieve-boundary="page"
retrieve-position="last-starting-within-page"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:table>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="40mm"/>
<fo:table-column column-width="8mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-body>
<xsl:apply-templates select="//row">
<xsl:sort data-type="text"
select="LOB_NM"/>
</xsl:apply-templates>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="row">
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:marker marker-class-name="subtotalname">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:text>total</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>subtotal</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:marker>
<fo:marker marker-class-name="subtotalvalue">
<xsl:value-of select="ID + sum(preceding::ID)"/>
</fo:marker>
<xsl:value-of select="LOB_NM"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align-last="end"><xsl:value-of
select="ID"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PIPELINE_NAME"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="NOTES"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PIPELINE"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PROJ_CM"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="OWNER"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
Any help would be appreciated....
Thanks
Shon
Here's my xml :
<ResultSet>
<row>
<LOB_NM><![CDATA[Commercial]]></LOB_NM>
<PIPELINE_NAME>GCI Profit Rpt</PIPELINE_NAME>
<ID><![CDATA[45]]></ID>
<PID><![CDATA[11]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>Marketing</PIPELINE_NAME>
<PID><![CDATA[10]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>golf</PIPELINE_NAME>
<ID><![CDATA[12]]></ID>
<PID><![CDATA[23]]></PID>
</row>
<row>
<LOB_NM>CIB</LOB_NM>
<PIPELINE_NAME>ss1</PIPELINE_NAME>
<ID><![CDATA[12]]></ID>
<PID><![CDATA[12]]></PID>
</row>
<row>
<LOB_NM>Commercial</LOB_NM>
<PIPELINE_NAME>Industry Focus</PIPELINE_NAME>
<ID><![CDATA[10]]></ID>
<PID><![CDATA[25]]></PID>
</row>
</ResultSet>
This is the way I want my final output to appear :
CIB Marketing Contact 10
CIB golf 12 23
CIB ss1 12 12
____________________________________________
CIB Totals 24 45
--Page Break
Commercial GCI Profit Rpt 45 11
Commercial Industry Focus 10 25
____________________________________________
Commecial Totals 55 36
--Page Break
This is my stylesheet :
<?xml version="1.0"?>
<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">
<fo:layout-master-set>
<fo:simple-page-master master-name="Landscape" page-height="9in"
page-width="15in" margin-left="2.5cm" margin-right="2.5cm">
<fo:region-body margin-top="3cm" />
<fo:region-after extent="3cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Landscape">
<fo:static-content flow-name="xsl-region-after">
<fo:table>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:retrieve-marker retrieve-class-name="subtotalname"
retrieve-boundary="page"
retrieve-position="last-starting-within-page"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align-last="end">
<fo:retrieve-marker retrieve-class-name="subtotalvalue"
retrieve-boundary="page"
retrieve-position="last-starting-within-page"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:table>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="40mm"/>
<fo:table-column column-width="8mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-body>
<xsl:apply-templates select="//row">
<xsl:sort data-type="text"
select="LOB_NM"/>
</xsl:apply-templates>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="row">
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:marker marker-class-name="subtotalname">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:text>total</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>subtotal</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:marker>
<fo:marker marker-class-name="subtotalvalue">
<xsl:value-of select="ID + sum(preceding::ID)"/>
</fo:marker>
<xsl:value-of select="LOB_NM"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align-last="end"><xsl:value-of
select="ID"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PIPELINE_NAME"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="NOTES"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PIPELINE"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="PROJ_CM"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="OWNER"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
Any help would be appreciated....
Thanks
Shon
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service