How do I reset to the first page - xslt

I am doing an xsl transform and I want to put several different documents in the same pdf. I have simple-page-masters for the first page, last page and other pages. I need to figure out a way to start a new document by using the last page and then the first page and reset the page numbers.
<fo:layout-master-set>
<fo:simple-page-master master-name="first-page">
<fo:region-body margin-bottom="1in" region-name="main-body"/>
<fo:region-after extent="1in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="other-pages">
<fo:region-body margin-top=".5in" margin-bottom=".5in" region-name="main-body"/>
<fo:region-before extent=".5in" region-name="page-header" display-align="before"/>
<fo:region-after extent=".5in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="last-page">
<fo:region-body margin-top=".5in" margin-bottom="1in" region-name="main-body"/>
<fo:region-before extent=".5in" region-name="page-header" display-align="before"/>
<fo:region-after extent="1in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="my-sequence">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first"
master-reference="first-page"/>
<fo:conditional-page-master-reference page-position="last"
master-reference="last-page"/>
<fo:conditional-page-master-reference odd-or-even="rest"
master-reference="other-pages"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
I tried setting the initial-page-number but it won't let me do it inside a page. Any ideas?
Here is the page-sequence.
<fo:page-sequence master-reference="my-sequence">
<fo:static-content flow-name="page-header" font-style="italic">
<xsl:if test="/Report[string-length(#print-page-headers) = 0 or #print-page-headers != 'false']">
<fo:block>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row line-height="12pt" font-size="10pt">
<fo:table-cell>
<fo:block text-align="left">
<xsl:value-of select="/Report/ReportInfo/title "/>
</fo:block>
</fo:table-cell>
<fo:table-cell line-height="12pt" font-size="10pt">
<fo:block text-align="right">
Page <fo:page-number/> of <fo:page-number-citation ref-id="terminator"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>
<fo:leader leader-pattern="rule" rule-thickness="1pt" leader-length="100%"/>
</fo:block>
</xsl:if>
</fo:static-content>
<fo:static-content flow-name="page-footer">
<xsl:if test="/Report[string-length(#print-page-footers) = 0 or #print-page-footers != 'false']">
<fo:block >
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-body>
<fo:table-row height="9in">
<fo:table-cell display-align="after">
<fo:retrieve-marker retrieve-class-name="includes"/>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell text-align="left">
<fo:block font-family="serif" font-size="8pt">
<xsl:value-of select="/Report/reportName"/>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="center">
<fo:block font-family="serif" font-size="6pt">
<xsl:text></xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right">
<fo:block font-family="serif" font-size="8pt">
<xsl:value-of select="/Report/ReportInfo/date"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="3" text-align="center">
<fo:block font-family="serif" font-size="6pt">
<xsl:text></xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:if>
</fo:static-content>
<fo:flow flow-name="main-body">
<fo:block hyphenate="true" language="en">
<xsl:apply-templates/>
</fo:block>
<fo:block id="terminator"/>
</fo:flow>
</fo:page-sequence>
I tried using a template to reset the initial page number:
<xsl:template match="newreport">
<fo:page-sequence initial-page-number="1" master-reference="my-sequence">
<fo:static-content flow-name="page-header" font-style="italic">
<fo:block break-before="page"/>
<fo:block>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row line-height="12pt" font-size="10pt">
<fo:table-cell>
<fo:block text-align="left">
<xsl:value-of select="/Report/ReportInfo/title "/>
</fo:block>
</fo:table-cell>
<fo:table-cell line-height="12pt" font-size="10pt">
<fo:block text-align="right">
Page <fo:page-number/> of <fo:page-number-citation ref-id="terminator"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>
<fo:leader leader-pattern="rule" rule-thickness="1pt" leader-length="100%"/>
</fo:block>
</fo:static-content>
</fo:page-sequence>
</xsl:template>
This doesn't work. I copied the code from the first page sequence. I want to be able to reset to the first page and do the page header, etc.

Perhaps you wish to adapt this sample to your, this works perfectly fine for Page X of Y references in a multiple batch document. One key here is that you must use a unique reference to document "chunk". You would use something unique in the XML, but I find it just as easy to use generate-id(.) on the repeating document, adding that id to the fo:flow and then using fo:page-number-citation-last with that id. Thus you get the last page of each of the flows.
Sample input:
<batch>
<document>
<page/>
<page/>
<page/>
<page/>
<page/>
</document>
<document>
<page/>
<page/>
<page/>
</document>
<document>
<page/>
<page/>
<page/>
</document>
</batch>
Sample XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="pages">
<fo:region-body margin-top="1in"/>
<fo:region-before extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:apply-templates/>
</fo:root>
</xsl:template>
<xsl:template match="document">
<fo:page-sequence master-reference="pages" initial-page-number="1" force-page-count="no-force">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
Page <fo:page-number/> of <fo:page-number-citation-last ref-id="{generate-id(.)}"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" id="{generate-id(.)}">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template match="page">
<fo:block break-before="page">
I am a page
</fo:block>
</xsl:template>
</xsl:stylesheet>
The output shows 1 of 5, 2 of 5, 3 of 5 ... followed by 1 of 3, 2 of 3 ... works perfect.

Related

generate fo:table running title/header by table fragment position

I found many answers how to generate running titles and table-headers, but no one fits conditions:
First table fragment should have title "Title of table $tablenum"
From second to rowsCount-1 should have title "Continue of table"
Last table fragment should have title "End of table".
I found retrieve-table-marker, and put markers on each row, but with it i can fit only in 2 conditions:
1-2 (and last table fragment also have "Continue of table" header) with
<retrieve-table-marker retrieve-position-within-table="first-starting"/>
2-3 (First fragment have "Continue of table") with
<retrieve-table-marker retrieve-position-within-table="last-ending"/>
So, it can be solved, if i found how to do one of next thing:
can determine when xslt processing, that current table fragment is last/first
If it possible, i can set something like
<fo:table-row>
<xsl:choose>
<xsl:when test="is-last-fragment()">
<fo:marker marker-class-name="table-header">End of table</fo:marker>
</xsl:when>
<xsl:when test="position() = 1">
<fo:marker marker-class-name="table-header">End of table</fo:marker>
</xsl:when>
<xsl:otherwise>
<fo:marker marker-class-name="table-header">Continue of table</fo:marker>
</xsl:when>
</xsl:choose>
</fo:table-row>
and use <retrieve-table-marker retrieve-position-within-table="first-starting"/> in table header.
can hide first/last marker with other on retrieve-table-marker tag.
I use saxonb-xslt-9.1.0.8J from Saxonica as xslt processor and generate pdf with fop-2.1.
UPD:
XML data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<numbers>
<number>1</number>
<number>2</number>
<number>2</number>
<number>2</number>
<number>2</number>
<number>2</number>
<number>2</number>
<number>2</number>
<number>11</number>
<number>2</number>
<!-- and so on. Just dummy lines -->
</numbers>
XSL styles:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1">
<xsl:strip-space elements="*"/>
<xsl:template match="numbers">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="A4">
<fo:region-body region-name="body" margin="2cm"/>
<fo:region-before margin="4cm" extent="2cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="body">
<fo:table>
<fo:table-column/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block border-bottom-style="solid" border-bottom-color="black">
<fo:retrieve-table-marker retrieve-class-name="cont"
retrieve-position-within-table="last-ending"
retrieve-boundary-within-table="table-fragment"/> 
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates/>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="number">
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>
<xsl:if test="position() != 1 and position() != last()">continued</xsl:if>
<xsl:if test="position() = last()">ended</xsl:if>
</fo:inline>
</fo:marker>
<fo:block>
value: <xsl:apply-templates/> on line <xsl:value-of select="position()" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
This produce XSL-FO:
<?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 master-name="A4">
<fo:region-body region-name="body" margin="2cm"/>
<fo:region-before margin="4cm" extent="2cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="body">
<fo:table>
<fo:table-column/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block border-bottom-style="solid" border-bottom-color="black">
<fo:retrieve-table-marker retrieve-class-name="cont" retrieve-position-within-table="last-ending" retrieve-boundary-within-table="table-fragment"/> 
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline/>
</fo:marker>
<fo:block>
value: 1 on line 1</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 2</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 3</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 4</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 5</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 6</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 7</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 8</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 11 on line 9</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 2 on line 10</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>continued</fo:inline>
</fo:marker>
<fo:block>
value: 11 on line 11</fo:block>
</fo:table-cell>
</fo:table-row>
<!-- and so on... -->
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="cont">
<fo:inline>ended</fo:inline>
</fo:marker>
<fo:block>
value: 12 on line 172</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>

Preserving Tab-Space with XSL-FO

I did not found an explicit question like the following:
I want to convert XML to PDF preserving tabspace (ASCII 009) in XSL-FO.
My <fo:block /> looks like this:
<fo:block linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve">
<xsl:value-of select="orderText" />
</fo:block>
With this configuration I can preserve line breaks and normal spaces but no tab-space. I tried many attributes from this post: Preserving whitespace in PDF after XSL transform
but it still doesn't work. If I put in this:
Forename: John
Surname: Smith
I get this:
Forename: John
Surname: Smith
For Information:
In my XSL-FO I use a Layout-Master for formatting the page. Maybe this could be the problem.
This is the complete XSL-File.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<xsl:preserve-space elements="orderText" />
<!-- If we see an envelope, we create an FO document -->
<xsl:template match="/tiff">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm"
margin-top="1.5cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin-top="10mm" margin-bottom="5mm" />
<fo:region-before region-name="header" />
<fo:region-after region-name="footer" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body" text-align="justify" font-size="11pt">
<!-- This will call generate stream headers (if applicable) -->
<fo:block font-weight="bold" font-size="12pt" space-after="7mm">
<xsl:text>Informationen zum Auftraggeber</xsl:text>
</fo:block>
<fo:block space-after="7mm">
<fo:table>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Auftragsnummer</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="orderId" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Erstellt von</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="creator" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Erstellt am</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="createDate" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Verwendete mTAN</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="mTAN" /></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block font-weight="bold" font-size="12pt" space-after="7mm">
<xsl:text>Informationen zum Kunden</xsl:text>
</fo:block>
<fo:block space-after="7mm">
<fo:table>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>ZAD-Kundennummer</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="customerId" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Name</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="surname" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Vorname</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="forename" /></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block font-weight="bold" font-size="12pt" space-after="7mm">
<xsl:text>Informationen zum Vertrag</xsl:text>
</fo:block>
<fo:block space-after="7mm">
<fo:table>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Versicherungsscheinnummer</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="vsnr" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Bestandsart</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="ba" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Konzerngesellschaft</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="kg" /></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block font-weight="bold" font-size="12pt" space-after="7mm">
<xsl:text>Auftragstext</xsl:text>
</fo:block>
<fo:block linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve">
<xsl:value-of select="orderText" />
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
XSL-FO does not handle tabs other than being whitespaces. A tab does not have a specific width, and there are not "tab stops" defined in the blocks.
Positioning in XSL-FO is done through block, and position properties. It looks like what you want here, is to use an extra column and split the value in 2: the first part in one cell, the second part in the other.

Wrap within table-cell with long word in FOP

I have a table in FOP and it is working nicely until I get a very long word. The word then overwrites the cell ending in the table. I tried the wrap-option="wrap" within the table-cell and/or the block of the cell but it doesn't work
**Total Edit**
since I guess it is to complicated to just show bits here is the complete xsl file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
<xsl:param name="tableCell" select="'1.0'" />
<!-- Globale Variablen START -->
<xsl:param name="tabbgcolor" select="'#EEEEEE'" />
<!-- Globale Variablen ENDE -->
<xsl:template match="/datasheet">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<fo:layout-master-set>
<fo:simple-page-master page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1.5cm" margin-right="1.5cm" master-name="first">
<fo:region-body margin-top="20mm" margin-bottom="20mm" />
<fo:region-before extent="15mm" />
<fo:region-after extent="15mcm" />
</fo:simple-page-master>
<fo:simple-page-master master-name="new" margin-right="1.0cm" margin-left="1.0cm" margin-bottom="1cm" margin-top="1cm" page-height="21cm" page-width="29.7cm">
<fo:region-body margin-top="30mm" margin-bottom="20mm" />
<fo:region-before extent="30mm" />
<fo:region-after extent="15mm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence language="de" country="DE" master-reference="new" initial-page-number="1">
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="center" font-size="12pt" padding="5pt" font-weight="bold">
<xsl:value-of select="title" />
</fo:block>
<fo:block text-align="right" font-size="12pt" padding="5pt" font-weight="bold">
<xsl:value-of select="date" />
</fo:block>
<fo:block text-align="right" font-size="12pt" padding="0pt" font-weight="bold">
<xsl:value-of select="time" />
</fo:block>
<fo:block>
<fo:leader leader-length="100%" leader-pattern="rule" rule-thickness="2pt" color="black" />
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center">
Seite
<fo:page-number />
von
<fo:page-number-citation ref-id="TheVeryLastPage" />
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:leader />
</fo:block>
<fo:block>
<fo:leader />
</fo:block>
<fo:block>
<fo:leader />
</fo:block>
<fo:block font-weight="bold" padding="5pt" padding-top="25pt">
Jahre <xsl:value-of select="fromYear" /> bis <xsl:value-of select="toYear" />
</fo:block>
<fo:block text-align="center">
<xsl:choose>
<xsl:when test="dataList != ''">
<fo:table table-layout="fixed" width="100%" border-style="solide" border-width="1pt">
<fo:table-column column-width="25%" border-style="solid" border-width="1pt" />
<fo:table-column column-width="25%" border-style="solid" border-width="1pt" />
<fo:table-column column-width="25%" border-style="solid" border-width="1pt" />
<fo:table-column column-width="25%" border-style="solid" border-width="1pt" />
<fo:table-header>
<fo:table-row>
<fo:table-cell border-style="solid" font-weight="bold" border-width="0pt">
<fo:block>
Cell1
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" font-weight="bold" border-width="0pt">
<fo:block>
Cell2
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" font-weight="bold" border-width="0pt">
<fo:block>
Cell3
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" font-weight="bold" border-width="0pt">
<fo:block>
Cell4
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select="dataList">
<fo:table-row>
<fo:table-cell padding="5pt" border-style="solid" border-width="1pt">
<fo:block text-align="left">
<xsl:value-of select="data1" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding="5pt" border-style="solid" border-width="1pt">
<fo:block text-align="left">
<xsl:value-of select="data2" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding="5pt" border-style="solid" border-width="1pt">
<fo:block text-align="left">
<xsl:value-of select="data3" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding="5pt" border-style="solid" border-width="1pt">
<fo:block text-align="left">
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="data4"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:when>
<xsl:otherwise>
<fo:block padding="6cm" text-align="center" font-weight="bold" font-size="16pt">No data.
</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:block>
<fo:block id="TheVeryLastPage">
</fo:block>
</fo:flow>
</fo:page-sequence>
<!-- ___________________________________________________________________________________________________________ -->
</fo:root>
</xsl:template>
<xsl:template name="intersperse-with-zero-spaces">
<xsl:param name="str"/>
<xsl:variable name="spacechars">
      
     ​
</xsl:variable>
<xsl:if test="string-length($str) > 0">
<xsl:variable name="c1" select="substring($str, 1, 1)"/>
<xsl:variable name="c2" select="substring($str, 2, 1)"/>
<xsl:value-of select="$c1"/>
<xsl:if test="$c2 != '' and
not(contains($spacechars, $c1) or
contains($spacechars, $c2))">
<xsl:text>​</xsl:text>
</xsl:if>
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="substring($str, 2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
The cell data4 is the one with the problems.... like 255 digits or characters at once with no hyphen oder space.
The input is from a database but could be like:
<datasheet>
<dataList>
<data1>intro</data1>
<data2>section</data2>
<data3>cutters</data3>
<data4>743576746876357467569384657654687465874638563465873487435767468763574675693846576546874658746385634658734874357674687635746756938465765468746587463856346587348743576746876357467569384657654687465874638563465873487435767468763574675693846576546874658746385634658734874357674687635746756938465765468746587463856346587348743576746876357467569384657654687465874638563465873487435767468763574675693846576546874658746385634658734874357674687635746756938465765468746587463856346587348743576746876357467569384657654687465874638563465873487435767468763574675693846576546874658746385634658734874357674687635746756938465765468746587463856346587348</data4>
</dataList>
</datasheet>
the result should be a table like:
|cell1 |cell2 |cell3 |cell4 |
_________________________________
|intro |section|cutters|7435767|
|4687635|
|7467569|
|3846576|
_________________________________
and so on in cell 4
Now the above works
<xsl:template name="intersperse-with-zero-spaces">
<xsl:param name="str"/>
<xsl:variable name="spacechars">
      
     ​
</xsl:variable>
<xsl:if test="string-length($str) > 0">
<xsl:variable name="c1" select="substring($str, 1, 1)"/>
<xsl:variable name="c2" select="substring($str, 2, 1)"/>
<xsl:value-of select="$c1"/>
<xsl:if test="$c2 != '' and
not(contains($spacechars, $c1) or
contains($spacechars, $c2))">
<xsl:text>​</xsl:text>
</xsl:if>
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="substring($str, 2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
calling place use to call like below:
<fo:block text-align="left">
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="data4"/>
</xsl:call-template>
</fo:block>
I tested, it's working fine.
One option would be for you to break up the long number/word in XSLT while you're transforming to FO. You'd have to decide where you want it to break.
See also:
XSL-FO fop. Long text flows into adjacent cells/block, obscuring stuff there
Update (copied from comment):
There must be copy/paste errors in the stylesheet... there is an <xsl:param>, which is only supposed to occur at the beginning of a template, in the middle of the template. The stylesheet is therefore invalid. Are there supposed to be two templates? Also, I don't yet see the template named intersperse-with-zero-spaces; but maybe you're still adding it.
Update 2:
The above has been fixed in the Question.
I had assumed the second template couldn't be intersperse-with-zero-spaces, since it was calling that template. It didn't occur to me that it was supposed to be a recursive template!
By the way, if you have the option of using XSLT 2.0, the intersperse-with-zero-spaces template could be replaced by a much more efficient regexp replace.
Add hyphenate="true", then it will automatically adjust the spaces in the table cell.
<fo:table-cell border-bottom-width="0px" border-left-width="0px"
border-right-width="0px" border-top-width="0px" font-size="9px"
padding-left="0px" border-style="solid" border-width="1pt"
border-color="white" padding-start="0px" padding-end="2px"
padding-before="0px" padding-after="0px" width="16%" display-align="center"
text-align="start" hyphenate="true">

xsl fo page size / orientation

I am designing an xsl that will give a pdf output. My pdf output is in landscape format.
I can't get the landscape formatted output even i change the simple page master as follows,
Still my pdf output's height is greater than the width.
Hi mzjn, i dont have any link. attached the expected and resulted pdf outputs, also need to know how to use the border image. tried as background image for region body and failed.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes" />
<xsl:param name="versionParam" select="'1.0'" />
<xsl:template match="#*|node()">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Start of page layout -->
<fo:layout-master-set>
<fo:simple-page-master master-name="A4"
page-width="8.27in" page-height="11.69in" margin-top="5mm"
margin-bottom="5mm" margin-left="5mm" margin-right="5mm"
reference-orientation="90">
<fo:region-body margin-top=".5cm" margin-bottom=".5cm"
margin-left=".5cm" margin-right=".5cm">
<xsl:if test="isPreview='true'">
<xsl:attribute name="background-image">file:///<xsl:value-of
select="pdfimagepath" />Preview Only1.JPG</xsl:attribute>
</xsl:if>
</fo:region-body>
<fo:region-before extent="0mm" />
<fo:region-after extent="0mm" />
</fo:simple-page-master>
</fo:layout-master-set>
<!-- End of page layout -->
<fo:page-sequence master-reference="A4">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
<fo:leader></fo:leader>
</fo:block>
<fo:block text-align="right" font-size="9pt" font-weight="bold">
<xsl:value-of select="num" />
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="9pt" font-family="times" text-align="left">
<xsl:value-of select="xxx" />
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table table-layout="fixed" width="100%">
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell width="100%">
<fo:block text-align="center" padding-top="2pt">
<fo:external-graphic content-height="85%"
content-width="65%" scaling="uniform">
<xsl:attribute name="src">
<xsl:value-of select="pdfimagepath" />LogoCert.jpg
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell width="100%">
<fo:block text-align="center">
<fo:external-graphic content-height="45%"
content-width="55%" scaling="non-uniform">
<xsl:attribute name="src">
<xsl:value-of select="pdfimagepath" />title.jpg
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell width="100%">
<fo:block font-size="15.5pt" font-family="Arial"
color="Black" text-align="center" padding-before="5pt"
start-indent="10pt">
</fo:block>
<fo:block font-size="15.5pt" font-family="Arial"
color="Black" text-align="center" start-indent="5pt">xxxxxx:
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell width="100%">
<fo:block font-size="16.5pt" font-family="Arial"
color="red" text-align="center" padding-before="8pt">
<xsl:value-of select="custname" />
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell width="100%">
<fo:block font-size="13.5pt" font-family="Arial"
color="black" text-align="center" padding-before="10pt"
start-indent="10pt">
<fo:inline background-color="yellow">xxxx</fo:inline>xxxx
</fo:block>
<fo:block font-size="13.5pt" font-family="Arial"
color="black" text-align="center" start-indent="10pt"> xxxx
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding-start="140pt" padding-end="140pt">
<fo:block font-size="10pt" font-family="Arial" color="black"
text-align="center" border-bottom="solid">
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell display-align="after"
padding-after="12pt" padding-before="2pt">
<fo:block font-size="15.5pt" font-family="Arial"
color="black" text-align="center"> xxxx
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding-start="160pt" padding-end="160pt">
<fo:block font-size="10pt" font-family="Arial" color="black"
text-align="center" border-bottom="solid">
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding-before="2pt"
display-align="before">
<fo:block font-size="15.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding-before="10pt">
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center"> xxxx
</fo:block>
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
<fo:block font-size="8.5pt" font-family="Arial"
color="black" text-align="center">
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell padding-before="5pt"
padding-start="60pt" padding-end="60pt">
<fo:block font-size="20pt" font-family="Arial" color="black"
text-align="center" border-bottom="solid">
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="40%" />
<fo:table-column column-width="60%" />
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-before="5pt">
<fo:block font-size="9.5pt" text-align="left"
font-weight="normal">
</fo:block>
</fo:table-cell>
<fo:table-cell padding-before="5pt">
<fo:block font-size="9.5pt" text-align="center">
</fo:block>
<fo:block font-size="9.5pt" text-align="center"
end-indent="10pt">
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="50%" />
<fo:table-column column-width="50%" />
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-before="5pt"
display-align="after" border="">
<fo:block font-size="10pt" text-align="left"
font-weight="normal">
</fo:block>
<fo:block font-size="13.5pt" text-align="center"
font-weight="normal">
</fo:block>
</fo:table-cell>
<fo:table-cell padding-before="5pt"
display-align="after" border="">
<fo:block text-align="center">
<fo:external-graphic content-height="60%"
content-width="40%" scaling="uniform">
<xsl:attribute name="src">
<xsl:value-of select="pdfimagepath" />sign.jpg
</xsl:attribute>
</fo:external-graphic>
</fo:block>
<fo:block padding-bottom="1pt" font-size="15pt"
text-align="center" font-weight="bold">
_____________________________
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell display-align="after" border="">
<fo:block font-size="8pt" text-align="left"
font-weight="normal">
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="after" border=""
padding-before="1pt">
<fo:block font-size="8.5pt" text-align="center"
font-weight="normal">xxxxx
</fo:block>
<fo:block font-size="8.5pt" text-align="center"
font-weight="normal">yyyyy
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
code sample attached
I am using Apache FOP 1.1.First you should define layout of landscape(A2).For Example
<fo:layout-master-set>
<fo:simple-page-master master-name="A2"
page-height="594mm" page-width="420mm" margin-left="0.2cm"
margin-right="0.2cm">
<fo:region-body margin-top="0.5cm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A2">
<fo:flow flow-name="xsl-region-body">
**//your design and logic**
</fo:flow>
</fo:page-sequence>
Thank you.
I'm not sure how to set the background, but below is how I was able to change the page width and height to result in landscape orientation.
I'm editing xsl files for PDF2 that came with the DITA open toolkit. I'm not sure if the filename will be the same, but I found the below chunk of code in layout-masters-attr.xsl. Notice I switched the page-width and page-height variables.
<xsl-attribute-set name="simple-page-master">
<xsl-attribute name="page-width">
<xsl:value-of select="$page-height"/>
</xsl:attribute>
<xsl:attribute name="page-height">
<xsl:value-of select="$page-width"/>
</xsl:attribute>
</xsl:attribute-set>
This will set the entire PDF document to landscape mode. Also, you can find where the variables are defined and change them to other values, if desired.

.fo creates PDF file not as expected

I have an XSLT stylesheet that outputs XSL-FO, which is used to generate a PDF file. I am returning bookings of the current week and want to print the bookings in the PDF file grouped-by the weekday. Everything works fine except for the weekday which the booking belongs to.
To illustrate my problem, I have made a screenshot of my generated PDF file:
WeeklyBPlan
As you can see on the picture, the first three bookings belongs to 25.Dezember.2012. If I put the xsl:for-each like in the code I posted, then the the weekday is displayed on each booking.
If I put the xsl:for-each in the table body, all bookings, whether the booking belongs to 26.dezember or 27. dezember, get assigned to 25.dezember. I don't know what I am doing wrong. How can I print the weekdays with the bookings correctly?
<xsl:template match="/">
<fo:root>
<!-- defines the layout master -->
<fo:layout-master-set>
<fo:simple-page-master master-name="first"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2cm"
margin-right="2cm">
<fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
<fo:region-before region-name="kopf" extent="3cm"/>
<fo:region-after region-name="fuss" extent="1.5cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="quer"
page-width="29.7cm"
page-height="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2cm"
margin-right="2cm">
<fo:region-body margin-top="1cm" margin-bottom="1.5cm" />
<fo:region-before region-name="kopf" extent="1cm"/>
<fo:region-after region-name="fuss" extent="0.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- starts actual layout -->
<fo:page-sequence master-reference="quer">
<fo:static-content flow-name="kopf">
<fo:block font-weight="bold" text-align="center" font-family="Arial" font-size="18pt">
<xsl:text>Test</xsl:text>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="fuss">
<fo:block border-bottom-width="thin" border-bottom-style="solid"
border-bottom-color="black" font-weight="bold" text-align="right" font-family="Arial" font-size="9pt">
erstellt am:
<xsl:value-of select="lfsExtension:FormatDateTime(.//Erstellt, 'dd.MM.yy HH:mm')"/>
<xsl:text> Seite: </xsl:text><fo:page-number/>/<fo:page-number-citation ref-id="lastBlock"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<!--this defines a title level 1 -->
<xsl:for-each select=".//WeeklyBPlan" >
<fo:block
line-height="24pt"
space-after.optimum="15pt"
padding-top="3pt">
<xsl:value-of select=".//WEEKDAY" />
</fo:block>
<!-- table start -->
<fo:table table-layout="fixed" border="solid" border-collapse="collapse" border-width="0.5pt">
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="12mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="50mm"/>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="10mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-column column-width="35mm"/>
<fo:table-column column-width="35mm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Raum</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Zeit</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Abteilung</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Thema</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Mieter</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Tel.-Nr</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">PAnz</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Bestuhlung</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Bemerkung</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block background-color="grey"
color="white" text-align="center">Ausstattung</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-right="6pt" padding-left="6pt" >
<fo:block font-family="Arial" font-size="9pt" padding="2pt">
<xsl:value-of select=".//Raum" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Zeit" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Abteilung" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-left="6pt" padding-right="6pt">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" wrap-option="no-wrap" >
<xsl:value-of select=".//Thema" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Mieter" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Mieter_Tel" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Personen" />
</fo:block>
</fo:table-cell>
<fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center">
<xsl:value-of select=".//Bestuhlung" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding-left="8pt" border-right-style="solid" border-bottom-width="0.5pt" border-right-width="0.5pt" border-bottom-style="solid" >
<fo:block font-family="Arial" font-size="9pt" padding="2pt">
<xsl:value-of select=".//Bemerkung" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding-left="6pt" padding-right="6pt" border-bottom-width="0.5pt" border-bottom-style="solid">
<fo:block font-family="Arial" font-size="9pt" padding="2pt">
<xsl:value-of select=".//Ausstattung" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<!-- table end -->
</xsl:for-each>
<fo:block id="lastBlock"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
Use for-each-group to group by Date
<xsl:for-each-group select=".//WeeklyBPlan" group-by="/WEEKDAY">
<fo:block line-height="24pt" space-after.optimum="15pt"
padding-top="3pt">
<xsl:value-of select="current-grouping-key()" />
</fo:block>
//table header here
<xsl:for-each select="current-group()">
// populate table row
</xsl:for-each>
</xsl:for-each-group>