As Chris pointed out this is not possible in the current implementation, and I don't think it is possible within the XSL-1.1 scope.
However if you are willing to edit intermediate format and your table layout allows it (i.e., there is enough space) then it is not very complicated to get the result you desire. Of course, whether it is practical or not depends on how many documents you need to edit.
Attached is an example: 1. fop -fo test.fo -if application/pdf test.if.xml 2. edit test.if.xml 3. fop -ifin test-edited.if.xml -pdf test-edited.pdfThis works if there is enough space to write the explicit calculation, i.e., i - a + A. I hope the example is clear.
On 6/27/13 12:20 AM, Luis Bernardo (JIRA) wrote:
[ https://issues.apache.org/jira/browse/FOP-2269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13694347#comment-13694347 ] Luis Bernardo commented on FOP-2269: ------------------------------------ See mailing list for a possible workaround.fo:marker for subtotals by page ------------------------------- Key: FOP-2269 URL: https://issues.apache.org/jira/browse/FOP-2269 Project: Fop Issue Type: Bug Reporter: Lisdiana Rodriguez Alvarado Priority: Blocker Hi, I'm working in a project that must generate a PDF Invoice using a XML as source. I'm using FOP 1.1 and the PDFs are generated almost like I expect, but my current problem is that each page must show subtotals. I need these totals by page, not accumulative. I'm trying using fo:retrieve-marker (retrieve-boundary="page") in the page footer and also with fo:retrieve-table-marker(retrieve-boundary-within-table="page") in the footer of a table. However in both cases, subtotals contains not just the accumulative in the current page but the amounts in the previous ones. I've been looking samples but I can't find what I'm doing wrong. I need to know if it's possible to do what I need to, and if so, I need a sample or guide to know how to "reset" the subtotals in every page. Thanks in advance.-- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
<?xml version="1.0" encoding="UTF-8"?> <document xmlns="http://xmlgraphics.apache.org/fop/intermediate" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation" xmlns:foi="http://xmlgraphics.apache.org/fop/internal" version="2.0"> <header> <x:xmpmeta xmlns:x="adobe:ns:meta/"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""> <xmp:CreateDate>2013-06-27T00:12:34+01:00</xmp:CreateDate> <xmp:CreatorTool>Apache FOP Version svn-trunk</xmp:CreatorTool> <xmp:MetadataDate>2013-06-27T00:12:34+01:00</xmp:MetadataDate> </rdf:Description> </rdf:RDF> </x:xmpmeta> </header> <page-sequence xml:space="preserve"> <page index="0" name="1" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">A</text> <g transform="translate(0,14400)"> <text x="0" y="10266">B</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">C</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">D</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">E</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">F</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">G</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">H</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">I</text> </g> <g transform="translate(0,129600)"> <text x="0" y="10266">Sum: i-a+A</text> </g> </viewport> </content> <page-trailer/> </page> <page index="1" name="2" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">J</text> <g transform="translate(0,14400)"> <text x="0" y="10266">K</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">L</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">M</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">N</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">O</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">P</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">Q</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">R</text> </g> <g transform="translate(0,129600)"> <text x="0" y="10266">Sum: r-j+J</text> </g> </viewport> </content> <page-trailer/> </page> <page index="2" name="3" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">S</text> <g transform="translate(0,14400)"> <text x="0" y="10266">T</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">U</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">V</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">W</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">X</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">Y</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">Z</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">Sum: z-s+S</text> </g> </viewport> </content> <page-trailer/> </page> </page-sequence> <trailer/> </document>
test-edited.pdf
Description: Adobe PDF document
<?xml version="1.0" encoding="UTF-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master margin="1cm" page-height="7.425cm" page-width="5.25cm" master-name="A8"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="A8"> <fo:flow flow-name="xsl-region-body"> <fo:block> <fo:table> <fo:table-header> <fo:table-cell> <fo:block></fo:block> </fo:table-cell> </fo:table-header> <fo:table-footer> <fo:table-cell> <!-- Note: the lowercase letter is the sum of all the preceeding letters including the current one --> <fo:block>Sum: <fo:retrieve-table-marker retrieve-class-name="sum" retrieve-position-within-table="last-starting" /> - <fo:retrieve-table-marker retrieve-class-name="sum" retrieve-position-within-table="first-starting" /> + <fo:retrieve-table-marker retrieve-class-name="elem" retrieve-position-within-table="first-starting" /> </fo:block> </fo:table-cell> </fo:table-footer> <fo:table-body> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">a</fo:marker><fo:marker marker-class-name="elem">A</fo:marker>A</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">b</fo:marker><fo:marker marker-class-name="elem">B</fo:marker>B</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">c</fo:marker><fo:marker marker-class-name="elem">C</fo:marker>C</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">d</fo:marker><fo:marker marker-class-name="elem">D</fo:marker>D</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">e</fo:marker><fo:marker marker-class-name="elem">E</fo:marker>E</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">f</fo:marker><fo:marker marker-class-name="elem">F</fo:marker>F</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">g</fo:marker><fo:marker marker-class-name="elem">G</fo:marker>G</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">h</fo:marker><fo:marker marker-class-name="elem">H</fo:marker>H</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">i</fo:marker><fo:marker marker-class-name="elem">I</fo:marker>I</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">j</fo:marker><fo:marker marker-class-name="elem">J</fo:marker>J</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">k</fo:marker><fo:marker marker-class-name="elem">K</fo:marker>K</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">l</fo:marker><fo:marker marker-class-name="elem">L</fo:marker>L</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">m</fo:marker><fo:marker marker-class-name="elem">M</fo:marker>M</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">n</fo:marker><fo:marker marker-class-name="elem">N</fo:marker>N</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">o</fo:marker><fo:marker marker-class-name="elem">O</fo:marker>O</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">p</fo:marker><fo:marker marker-class-name="elem">P</fo:marker>P</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">q</fo:marker><fo:marker marker-class-name="elem">Q</fo:marker>Q</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">r</fo:marker><fo:marker marker-class-name="elem">R</fo:marker>R</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">s</fo:marker><fo:marker marker-class-name="elem">S</fo:marker>S</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">t</fo:marker><fo:marker marker-class-name="elem">T</fo:marker>T</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">u</fo:marker><fo:marker marker-class-name="elem">U</fo:marker>U</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">v</fo:marker><fo:marker marker-class-name="elem">V</fo:marker>V</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">w</fo:marker><fo:marker marker-class-name="elem">W</fo:marker>W</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">x</fo:marker><fo:marker marker-class-name="elem">X</fo:marker>X</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">y</fo:marker><fo:marker marker-class-name="elem">Y</fo:marker>Y</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block><fo:marker marker-class-name="sum">z</fo:marker><fo:marker marker-class-name="elem">Z</fo:marker>Z</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block> </fo:flow> </fo:page-sequence> </fo:root>
<?xml version="1.0" encoding="UTF-8"?> <document xmlns="http://xmlgraphics.apache.org/fop/intermediate" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation" xmlns:foi="http://xmlgraphics.apache.org/fop/internal" version="2.0"> <header> <x:xmpmeta xmlns:x="adobe:ns:meta/"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""> <xmp:CreateDate>2013-06-27T00:15:59+01:00</xmp:CreateDate> <xmp:CreatorTool>Apache FOP Version svn-trunk</xmp:CreatorTool> <xmp:MetadataDate>2013-06-27T00:15:59+01:00</xmp:MetadataDate> </rdf:Description> </rdf:RDF> </x:xmpmeta> </header> <page-sequence xml:space="preserve"> <page index="0" name="1" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">A</text> <g transform="translate(0,14400)"> <text x="0" y="10266">B</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">C</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">D</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">E</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">F</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">G</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">H</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">I</text> </g> <g transform="translate(0,129600)"> <text x="0" y="10266">Sum: </text> <text x="31344" y="10266">i</text> <text x="34008" y="10266"> - </text> <text x="44676" y="10266">a</text> <text x="51348" y="10266"> + </text> <text x="65028" y="10266">A</text> </g> </viewport> </content> <page-trailer/> </page> <page index="1" name="2" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">J</text> <g transform="translate(0,14400)"> <text x="0" y="10266">K</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">L</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">M</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">N</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">O</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">P</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">Q</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">R</text> </g> <g transform="translate(0,129600)"> <text x="0" y="10266">Sum: </text> <text x="31344" y="10266">r</text> <text x="35340" y="10266"> - </text> <text x="46008" y="10266">j</text> <text x="48672" y="10266"> + </text> <text x="62352" y="10266">J</text> </g> </viewport> </content> <page-trailer/> </page> <page index="2" name="3" page-master-name="A8" width="148818" height="210472"> <page-header/> <content> <viewport transform="translate(28346,28346)" width="92126" height="153780"> <font family="sans-serif" style="normal" weight="400" variant="normal" size="12000" color="#000000"/> <text x="0" y="10266">S</text> <g transform="translate(0,14400)"> <text x="0" y="10266">T</text> </g> <g transform="translate(0,28800)"> <text x="0" y="10266">U</text> </g> <g transform="translate(0,43200)"> <text x="0" y="10266">V</text> </g> <g transform="translate(0,57600)"> <text x="0" y="10266">W</text> </g> <g transform="translate(0,72000)"> <text x="0" y="10266">X</text> </g> <g transform="translate(0,86400)"> <text x="0" y="10266">Y</text> </g> <g transform="translate(0,100800)"> <text x="0" y="10266">Z</text> </g> <g transform="translate(0,115200)"> <text x="0" y="10266">Sum: </text> <text x="31344" y="10266">z</text> <text x="37344" y="10266"> - </text> <text x="48012" y="10266">s</text> <text x="54012" y="10266"> + </text> <text x="67692" y="10266">S</text> </g> </viewport> </content> <page-trailer/> </page> </page-sequence> <trailer/> </document>
test.pdf
Description: Adobe PDF document
--------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org