I'm using Apache FOP to generate reports, my template's like this:
<xsl:template match="LOGO">
<xsl:param name="imgLogo">
<xsl:value-of select="IMG" />
</xsl:param>
<fo:external-graphic content-height="scale-to-fit"
height="50pt" src="{$imgLogo}" />
</xsl:template>
<xsl:template match="MYREPORT">
<fo:block>
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_1" />
</fo:block>
<fo:block page-break-before="always">
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_2" />
</fo:block>
<fo:block page-break-before="always">
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_3" />
</fo:block>
</xsl:template>
I've to hide the "LOGO" block (before each PAGE) if the next sibiling block (PAGE) is empty.
For example, with the following input:
<MYREPORT>
<LOGO>
<IMG>data:image/png;base64,[cutted]</IMG>
</LOGO>
<PAG_1>Page 1</PAG_1>
<PAG_2>Page 2</PAG_2>
</MYREPORT>
It should print:
LOGO
Page 1
(new page)
LOGO
Page 2
It's printing the following instead:
LOGO
Page 1
(new page)
LOGO
Page 2
(new page)
LOGO
Any idea? Thanks
The most direct way is to put an xsl:if around the code for PAG_3:
<xsl:template match="MYREPORT">
<fo:block>
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_1" />
</fo:block>
<fo:block page-break-before="always">
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_2" />
</fo:block>
<xsl:if test="PAG_3">
<fo:block page-break-before="always">
<xsl:apply-templates select="LOGO" />
</fo:block>
<fo:block>
<xsl:value-of select="PAG_3" />
</fo:block>
</xsl:if>
</xsl:template>
An alternative approach (which I would use) is to use xsl:apply-templates to select the PAG_* elements so that a result is generated only for elements that exist:
<xsl:template match="MYREPORT">
<xsl:apply-templates select="PAG_1 | PAG_2 | PAG_3" />
</xsl:template>
<xsl:template match="PAG_1 | PAG_2 | PAG_3">
<fo:block>
<xsl:if test="position() != 1">
<xsl:attribute name="page-break-before">always</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="../LOGO" />
</fo:block>
<fo:block>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Related
I am using apache fop to produce a PDF, I have an XSL-FO template that produces a table and I would like to be able to call the template multiple times, with different select parameters.
here is my xsl stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
version="1.0">
<xsl:output method="html"/>
<xsl:template name="checklist">
<xsl:param name="H1"/>
<xsl:param name="H2"/>
<xsl:param name="H3"/>
<xsl:param name="src"/>
<fo:block width="19cm" >
<fo:table font-size="8pt" table-layout="fixed" width="100%">
<fo:table-column column-width="1.2cm"/>
<fo:table-column column-width="16.5cm"/>
<fo:table-column column-width="1.2cm"/>
<fo:table-header font-weight="bold" background-color="lightgrey">
<fo:table-row>
<fo:table-cell>
<fo:block><xsl:value-of select="$H1"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="center"><xsl:value-of select="$H2"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:value-of select="$H3"/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="$src" />
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
<xsl:template match="item">
<fo:table-row line-stacking-strategy="line-height" margin="0mm" space-before="1mm" background-color="white">
<xsl:variable name="hdr" select="hdr"/>
<xsl:choose>
<xsl:when test="$hdr = 'y'">
<fo:table-cell number-columns-spanned="3" background-color="lightgrey" border="1px solid #b8b6b6">
<fo:block>
<fo:inline>
<xsl:value-of select="id"/>
<xsl:value-of select="description"/>
</fo:inline>
</fo:block>
</fo:table-cell>
</xsl:when>
<xsl:otherwise>
<fo:table-cell border="1px solid #b8b6b6" vertical-align="middle" text-align="center">
<fo:block line-height="4mm">
<xsl:value-of select="id"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border="1px solid #b8b6b6" padding-left="3pt">
<fo:block>
<xsl:value-of select="description"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border="1px solid #b8b6b6" text-align="center" padding-right="3pt">
<xsl:variable name="outcome" select="outcome"/>
<fo:block color="white">
<!--<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/c1.svg" width="4.0mm" height="4.0mm" content-width="scale-to-fit" content-height="scale-to-fit"/>-->
<xsl:choose>
<xsl:when test="$outcome = 'ok'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/c1n.svg" vertical-align="middle" height="4.0mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'c1'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/ok.svg" vertical-align="middle" height="3.9mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'c2'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/c2.svg" vertical-align="middle" height="3.8mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'c3'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/c3.svg" vertical-align="middle" height="3.7mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'fi'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/fi.svg" vertical-align="middle" height="3.6mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'nv'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/nv.svg" vertical-align="middle" height="3.5mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'na'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/na.svg" vertical-align="middle" height="3.4mm" content-height="scale-to-fit"/>
</xsl:when>
<xsl:when test="$outcome = 'lim'">
<fo:external-graphic src="file:///F:/Projects/Active/eCert/src/resources/lim.svg" vertical-align="middle" height="3.3mm" content-height="scale-to-fit"/>
</xsl:when>
</xsl:choose>
</fo:block>
</fo:table-cell>
</xsl:otherwise>
</xsl:choose>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
And here is one of the flows that calls the template
<fo:flow flow-name="xsl-region-body">
<fo:block />
<xsl:call-template name="checklist">
<xsl:with-param name="H1" select="'Item No.'"/>
<xsl:with-param name="H2" select="'Description'"/>
<xsl:with-param name="H3" select="'Outcome'"/>
<xsl:with-param name="src" select="'eicr/checklist/item'"/>
</xsl:call-template>
</fo:flow>
When I execute FOP I get the following error ** Can not convert #STRING to a NodeList!**
Parameters H1, H2 and H3 are used as the column headers and that part works fine
The src param is the one that should be used to select the items from from an xml list.
I am new xsl fo so any help or pointers to documentation that can help me achieve the desired result would be appreciated.
Many thanks
Remove the single-quotes around eicr/checklist/item. 'eicr/checklist/item' is a string literal; eicr/checklist/item is a location path that will select elements relative to the context node.
The alternative that I was trying to avoid (because it's more verbose) is to apply templates before or as part of calling the template and then just copying the result to the result tree:
<xsl:with-param name="src">
<xsl:apply-templates select="eicr/checklist/item" />
</xsl:with-param>
<fo:table-body>
<xsl:copy-of select="$src" />
</fo:table-body>
It's a technique that you see in the DocBook XSLT 1.0 stylesheets, e.g.:
https://github.com/docbook/xslt10-stylesheets/blob/6ff683948c5a85949e4b7661f302e8b5f12f7bf2/xsl/fo/block.xsl#L181
I have an xml document as shown below. Each repeating doc is a page in PDF file
<AFPXMLFile>
<docs>
<regList>
<region>1</region>
<secList>
<col>1</col>
<lines></lines>
</secList>
</regList>
<regList>
<region>2</region>
<secList>
<col>2</col>
<lines>
<line>IBM BELGIUM xxx</line>
<line>xxxxxx</line>
<line>xxxx</line>
</lines>
</secList>
</regList>
<regList></regList>
<regList></regList>
</docs>
<docs></docs>
</AFPXMLFile>
My XSL is as follows:
<?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:template match="AFPXMLFile">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master page-width="21cm" page-height="29.7cm" margin-top="1.27cm" margin-bottom="1.27cm" margin-left="1.75cm" master-name="A4">
<fo:region-body margin-top="1mm" margin-bottom="1mm"/>
<fo:region-before extent="0mm"/>
<fo:region-after extent="0mm"/>
<fo:region-start writing-mode="tb-rl" precedence="true" extent="10mm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4" font-family="sans-serif">
<xsl:for-each select="docs">
<xsl:for-each select="./regList">
<xsl:choose>
<xsl:when test="region = 1">
<fo:static-content flow-name="xsl-region-before">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="purple">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
<xsl:when test="region = 2">
<fo:static-content flow-name="xsl-region-start">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="4pt" padding-before="4pt" text-align="left" color="green">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
<xsl:when test="region = 3">
<fo:static-content flow-name="xsl-region-body">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="blue">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
<xsl:when test="region = 4">
<fo:flow flow-name="xsl-region-after">
<xsl:for-each select="./secList">
<xsl:for-each select="./lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="orange">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</fo:flow>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
When I run the transformation I get the following error:
org.apache.fop.fo.ValidationException: For "fo:page-sequence", "fo:static-content" must be declared before "fo:flow"! (No context info available)
This I suspect because it is repeating the static content region for each page. So I believe I need to change the simple-page-master:master-name for every page
I need help with that.
According to the XSL-FO recommendation, the contents of 'fo:page-sequence' is:
(title?,folio-prefix?,folio-suffix?,static-content*,flow+)
which means that all the fo:static-content elements must be before the fo:flow elements.
Your stylesheet dynamically creates either fo:static-content (if region is 1, 2 or 3) or fo:flow (if region is 4). From the reduced input file in your question it is not possible to see whether the regList elements are alway correctly sorted, so that they produce a valid output when sequentially processed.
Moreover, as each docs element represents a different document with different headers/footers, you have to create distinct fo:page-sequences instead of a single one (otherwise you get too many static contents and flows for a single page sequence):
<xsl:for-each select="docs">
<fo:page-sequence master-reference="A4" font-family="sans-serif">
<xsl:for-each select="./regList">
....
</xsl:for-each>
</fo:page-sequence>
</xsl:for-each>
Moreover, there is a strange thing in the stylesheet: you map an fo:static-content to the xsl-region-body region, and the fo:flow to the xsl-region-after region, which is quite unusual. If the "real" content for the body region is the one with region = 3, you must process region 1, 2 and 4 first, and then region 3:
<xsl:for-each select="docs">
<fo:page-sequence master-reference="A4" font-family="sans-serif">
<!-- create static contents -->
<xsl:apply-templates select="./regList[region != '3']"/>
<!-- create flow -->
<xsl:apply-templates select="./regList[region = '3']"/>
</fo:page-sequence>
</xsl:for-each>
with an additional template to match reglist:
<xsl:template match="regList">
<xsl:choose>
<xsl:when test="region = '1'">
<fo:static-content flow-name="xsl-region-before">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="purple">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
<xsl:when test="region = '2'">
<fo:static-content flow-name="xsl-region-start">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="4pt" padding-before="4pt" text-align="left" color="green">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
<xsl:when test="region = '3'">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="blue">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:flow>
</xsl:when>
<xsl:when test="region = '4'">
<fo:static-content flow-name="xsl-region-after">
<xsl:for-each select="./secList">
<xsl:for-each select="./lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="orange">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:when>
</xsl:choose>
</xsl:template>
or several, smaller templates:
<xsl:template match="reglist[region = '1']">
<fo:static-content flow-name="xsl-region-before">
<xsl:for-each select="./secList/lines">
<xsl:for-each select="node()">
<fo:block font-size="8pt" color="purple">
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</fo:static-content>
</xsl:template>
<xsl:template match="reglist[region = '2']">
...
</xsl:template>
...
XML:
<levelledPara><title>Tools List and Tool Illustrations</title>
<levelledPara><title>General</title>
<levelledPara><para>The special tools, fixtures, and equipment needed.</para></levelledPara></levelledPara>
XSLT:
<xsl:template match="levelledPara" name="levelledPara" mode="tocdm">
<xsl:if test="*[self::title] and not(parent::*[self::levelledPara])">
<xsl:variable name="id">
<xsl:call-template name="para.id"/>
</xsl:variable>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="table.cell.padding1" number-columns-spanned="2">
<fo:block text-transform="capitalize" text-align-last="justify" text-indent="21mm">
<xsl:number count="levelledPara" from="content" level="multiple" format="1.1.1.1.1"/>
<xsl:text> </xsl:text>
<xsl:value-of select="title" /><fo:leader leader-pattern="dots"/><fo:basic-link internal-destination="{$id}"><fo:page-number-citation ref-id="{$id}"/></fo:basic-link>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
</xsl:template>
<xsl:template match="levelledPara">
<fo:list-block
provisional-distance-between-starts="21mm"
provisional-label-separation="4pt">
<fo:list-item space-after="8pt" space-before="13pt" start-indent="0pt">
<xsl:variable name="id">
<xsl:if test="*[self::title] and not(parent::*[self::levelledPara])">
<xsl:call-template name="para.id"/>
</xsl:if>
</xsl:variable>
<fo:list-item-label
end-indent="label-end()"
text-align="start">
<fo:block font-weight="bold" id="{$id}">
<xsl:if test="not(./table)">
<xsl:number count="levelledPara" from="content" level="multiple" format="1.1.1.1.1"/>
</xsl:if>
</fo:block>
</fo:list-item-label>
<fo:list-item-body
start-indent="body-start()">
<xsl:apply-templates/>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
<xsl:template name="para.id">
<xsl:param name="object" select="."/>
<xsl:apply-templates select="ancestor::dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode"/>
<xsl:choose>
<xsl:when test="$object/#id">
<xsl:value-of select="$object/#id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(count(ancestor::node()),'00000000',count(preceding::node()))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
The first titled levelledPara should be included in the Table of Contents. In my sample markup none have IDs. The page number wasn't resolving because I forgot to assign an id to the fo:block for levelledPara.
You've shown the XSLT for the table of contents. The ID in the TOC should match an ID in the main text of your document.
So the template match="levelledPara" should contain a block that sets the ID:
<xsl:variable name="lpcode"><xsl:value-of select="$dmcode" /><xsl:value-of select="generate-id(.)" /></xsl:variable>
<fo:block id="{$lpcode}">
I have the following XML:
<Pattern name="Form" Date="12/18/2015 3:25 AM CST">
Swap_Conversion
<CurrentLocale />
<Patterns>
<Pattern name="Section">
Swap_Conversion
<Patterns>
<Pattern name="GroupResult" status="AUTH" inputType="19">
Ultrasound Duration
<Patterns>
<Pattern name="GridDTA">23350691</Pattern>
<Pattern name="GridDTA">56468381</Pattern>
<Pattern name="GridDTA">20218422</Pattern>
<Pattern name="GridDTA">21058661</Pattern>
<Pattern name="GridDTA">4156900</Pattern>
<Pattern name="GridDTA">20008930</Pattern>
<Pattern name="GridDTA">21197198</Pattern>
</Patterns>
<Patterns>
<Pattern name="GroupResult" status="AUTH" inputType="">
Ear Irrigation Solution
<Patterns />
<Patterns>
<Pattern name="CodedResult" status="AUTH" display="Ace Bandage :" taskAssayCode="23350691">2 inch</Pattern>
</Patterns>
</Pattern>
</Patterns>
<Patterns>
<Pattern name="GroupResult" status="AUTH" inputType="">
Frame Order Priority
<Patterns />
<Patterns>
<Pattern name="CodedResult" status="AUTH" display="Ace Bandage :" taskAssayCode="23350691">3 inch</Pattern>
</Patterns>
</Pattern>
</Patterns>
</Pattern>
</Patterns>
</Pattern>
</Patterns>
</Pattern
Currently I have the transpose which look something like:
But I want it to look something like:
Currently I had tried with which worked for transpose:
<xsl:choose>
<xsl:when test="$inputType='19'"
<xsl:variable name="groupNodeSet" select="Patterns/Pattern[#name='GroupResult']"/>
<xsl:for-each select="$groupNodeSet[position() <= ((last() + $tablecolumns - 1) div $tablecolumns)]">
<!-- loopCount indicates which table of the multiple tables that a grid control may be split into that we are currently generating-->
<xsl:variable name="loopCount" select="position()"/>
<fo:table border="1pt solid black">
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-width="thin">
<fo:block/>
</fo:table-cell>
<fo:table-cell>
<xsl:if test="$groupNodeSet[position()=((($loopCount - 1) * $tablecolumns) + 1)]">
<xsl:attribute name="border-width">
<xsl:text>thin</xsl:text>
</xsl:attribute>
</xsl:if>
<fo:block font-size="{$regularfontsize}" font-family="sans-serif" text-align="left" font-style="italic">
<xsl:value-of select="$groupNodeSet[position()=((($loopCount - 1) * $tablecolumns) + 1)]/text()"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<xsl:if test="$groupNodeSet[position()=((($loopCount - 1) * $tablecolumns) + 2)]">
<xsl:attribute name="border-width">
<xsl:text>thin</xsl:text>
</xsl:attribute>
</xsl:if>
<fo:block font-size="{$regularfontsize}" font-family="sans-serif" text-align="left" font-style="italic">
<xsl:value-of select="$groupNodeSet[position()=((($loopCount - 1) * $tablecolumns) + 2)]/text()"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="../../Patterns/Pattern[#name='GridDTA' and ../..//#taskAssayCode=text()]">
<xsl:variable name="taskassay">
<xsl:value-of select="node()"/>
</xsl:variable>
<fo:table-row>
<fo:table-cell border-width="thin">
<fo:block>
<xsl:value-of select="../..//Pattern/#display[../..//Pattern/#taskAssayCode=$taskassay]"/>
</fo:block>
</fo:table-cell>
<xsl:call-template name="GenerateGridTableCells">
<xsl:with-param name="count" select="1"/>
<xsl:with-param name="maxcount" select="$tablecolumns"/>
<xsl:with-param name="taskassay" select="$taskassay"/>
<xsl:with-param name="groupNodeSet" select="$groupNodeSet"/>
<xsl:with-param name="rowNumber" select="$loopCount"/>
</xsl:call-template>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:for-each>
</xsl:when>
</xsl:choose>
I have tried multiple approach for normal one (not the transpose) which isn't working for.
Can anyone help me in having the grid matrix without transpose for the above XML?
Since you're using XSLT 1.0, you're stuck with using Meunchian grouping (muenchian grouping, http://www.jenitennison.com/xslt/grouping/muenchian.html). Using XSLT 2.0 would have made it easier.
The version below can cope with a variations in the 'CodedResult' within each 'GroupResult'.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="regularfontsize" select="'12pt'"/>
<xsl:output indent="yes" />
<xsl:key name="coded-results"
match="Pattern[#name = 'CodedResult'][#status = 'AUTH']"
use="#display" />
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="a">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="a">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="Pattern/Patterns/Pattern[#name = 'Section']/Patterns/Pattern" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:variable name="inputType" select="'19'" />
<xsl:template match="Pattern[#inputType = '19']">
<xsl:variable name="all-coded-results"
select="Patterns/Pattern[#inputType = '']/Patterns/Pattern[#name = 'CodedResult']
[count(. | key('coded-results', #display)[1]) = 1]" />
<fo:table border="1pt solid black">
<fo:table-column/>
<xsl:for-each
select="$all-coded-results">
<fo:table-column/>
</xsl:for-each>
<fo:table-body>
<fo:table-row>
<fo:table-cell />
<xsl:for-each
select="$all-coded-results">
<xsl:sort />
<fo:table-cell>
<fo:block>
<xsl:value-of select="#display" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
<xsl:apply-templates select="Patterns/Pattern[#name = 'GroupResult']">
<xsl:with-param name="all-coded-results" select="$all-coded-results" />
</xsl:apply-templates>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="Pattern[#name = 'GroupResult'][#inputType = '']">
<xsl:param name="all-coded-results" />
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select="normalize-space(text())" />
</fo:block>
</fo:table-cell>
<xsl:variable name="this-pattern" select="." />
<xsl:for-each
select="$all-coded-results">
<xsl:sort />
<xsl:variable name="this-result" select="."/>
<fo:table-cell>
<xsl:if test="$this-pattern/Patterns/Pattern[#display = $this-result/#display]">
<fo:block>
<xsl:value-of select="$this-pattern/Patterns/Pattern[#display = $this-result/#display]" />
</fo:block>
</xsl:if>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:template>
</xsl:stylesheet>
I have XSL-FO with region-before, region-after, and region-body which has a table having 6 columns. The second column has 3 lines of data (name, address, city/state/zip). We render this into PDF.
If I simply apply my data, I will get a row at the end of the page, where the 2nd column has 1 line of text on the current page, and 2 lines end up on the next page.
If I apply keep-together="always" (or keep-together.within-column="always") my table starts on the 2nd page.
How can I get my data to page-break correctly? If I have not provided enough information, please comment and I will try to provide it.
Edit: XSL-FO attached; Added Stylesheet and XML; Added the rest of the XSLT
XML Data:
<?xml version="1.0" encoding="utf-8"?>
<AS400_ELVPLOC00Collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<COL_FILL_MODE>0</COL_FILL_MODE>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<SLMR_ERROR_LIST />
<ObjList>
<AS400_ELVPLOC00>
<ID>0</ID>
<DOC_LINK_ID>0</DOC_LINK_ID>
<EMAIL_LINK_ID>0</EMAIL_LINK_ID>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<OBJ_TYPE>AS400_ELVPLOC00</OBJ_TYPE>
<CRTD_DT>0001-01-01T00:00:00</CRTD_DT>
<MODFD_DT>0001-01-01T00:00:00</MODFD_DT>
<SLMR_ERROR_LIST />
<ELBLDGCD>11966</ELBLDGCD>
<ELBLDGCD_DISPLAY>11966</ELBLDGCD_DISPLAY>
<ELBLDGNM>TEST COMPANY</ELBLDGNM>
<ELLSTNUM>123</ELLSTNUM>
<ELLDIR></ELLDIR>
<ELLRDNUM>0</ELLRDNUM>
<ELLSTNM1>Nowhere</ELLSTNM1>
<ELLTYP1>St</ELLTYP1>
<ELLCITY>HARRISBURG</ELLCITY>
<ELLSTATE>PA</ELLSTATE>
<ELLZIPCD>17111</ELLZIPCD>
<ELLZIPCD_DISPLAY>18970</ELLZIPCD_DISPLAY>
<ELLZIPSX>0</ELLZIPSX>
<ELLZIPSX_DISPLAY />
<LOC_STREET_DISPLAY>123 Nowhere St</LOC_STREET_DISPLAY>
<LOC_STREET_DISPLAY2> </LOC_STREET_DISPLAY2>
<LOC_DISPLAY_NONUM>123 Nowhere St<br />HARRISBURG PA 17111</LOC_DISPLAY_NONUM>
<ELLCNTY>42017</ELLCNTY>
<ELLCNTY_NAME>Bucks</ELLCNTY_NAME>
<ELLCURRYY>0</ELLCURRYY>
<ELLCURRMM>0</ELLCURRMM>
<ELLCURRDD>0</ELLCURRDD>
<ELLCurrStatus_DT>0001-01-01T00:00:00</ELLCurrStatus_DT>
<FEE_CO_ID>0</FEE_CO_ID>
<INSPTR_ID>0</INSPTR_ID>
<ELLUPDTYY>0</ELLUPDTYY>
<ELLUPDTMM>0</ELLUPDTMM>
<ELLUPDTDD>0</ELLUPDTDD>
<ELLLastUpdate_DT>0001-01-01T00:00:00</ELLLastUpdate_DT>
<ELLPASTYY>0</ELLPASTYY>
<ELLPASTMM>0</ELLPASTMM>
<ELLPASTDD>0</ELLPASTDD>
<ELEPastStat_DT>0001-01-01T00:00:00</ELEPastStat_DT>
<AS400_ELVPEQP_COL>
<COL_FILL_MODE>0</COL_FILL_MODE>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<SLMR_ERROR_LIST />
<ObjList>
<AS400_ELVPEQP00>
<ID>114224</ID>
<DOC_LINK_ID>0</DOC_LINK_ID>
<EMAIL_LINK_ID>0</EMAIL_LINK_ID>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<OBJ_TYPE>AS400_ELVPEQP00</OBJ_TYPE>
<CRTD_DT>0001-01-01T00:00:00</CRTD_DT>
<MODFD_DT>0001-01-01T00:00:00</MODFD_DT>
<SLMR_ERROR_LIST />
<ELBLDGCD>11966</ELBLDGCD>
<ELEEQNO>1</ELEEQNO>
<ELEEQNO_DISPLAY>001</ELEEQNO_DISPLAY>
<ELEDTINY>1947</ELEDTINY>
<ELEDTINM>10</ELEDTINM>
<ELEDTIND>2</ELEDTIND>
<ELEInitInsp_DT>1947-10-02T00:00:00</ELEInitInsp_DT>
<ELEIRSLT>P</ELEIRSLT>
<ELEICDTY>0</ELEICDTY>
<ELEICDTM>0</ELEICDTM>
<ELEICDTD>0</ELEICDTD>
<ELEClear_DT>1900-01-01T00:00:00</ELEClear_DT>
<ELPERMTNO>194703851</ELPERMTNO>
<ELEPERMID>N</ELEPERMID>
<ELEDTISY>0</ELEDTISY>
<ELEDTISM>0</ELEDTISM>
<ELEDTISD>0</ELEDTISD>
<ELEPermitIssued_DT>1900-01-01T00:00:00</ELEPermitIssued_DT>
<ELELSEAL />
<ELEYCEXP>0</ELEYCEXP>
<ELEMCEXP>0</ELEMCEXP>
<ELECEXP_DT>0001-01-01T00:00:00</ELECEXP_DT>
<ELEYCISS>0</ELEYCISS>
<ELEMCISS>0</ELEMCISS>
<ELOFLNUM>11966</ELOFLNUM>
<ELERPNUM>11966</ELERPNUM>
<ELETYPELV>F</ELETYPELV>
<ELEINSPD>2</ELEINSPD>
<ELEDTWINY>0</ELEDTWINY>
<ELEDTWINM>0</ELEDTWINM>
<ELEDTWIND>0</ELEDTWIND>
<ELEMajRepair_DT>1900-01-01T00:00:00</ELEMajRepair_DT>
<ELEWCDTY>0</ELEWCDTY>
<ELEWCDTM>0</ELEWCDTM>
<ELEWCDTD>0</ELEWCDTD>
<ELEMajRepairClear_DT>1900-01-01T00:00:00</ELEMajRepairClear_DT>
<ELEDTLINY>2008</ELEDTLINY>
<ELEDTLINM>2</ELEDTLINM>
<ELEDTLIND>21</ELEDTLIND>
<ELELastInsp_DT>2008-02-21T00:00:00</ELELastInsp_DT>
<ELELAST_INSP_ID>1369887</ELELAST_INSP_ID>
<ELEUPDTYY>0</ELEUPDTYY>
<ELEUPDTMM>0</ELEUPDTMM>
<ELEUPDTDD>0</ELEUPDTDD>
<ELELastUpdate_DT>0001-01-01T00:00:00</ELELastUpdate_DT>
<ELELocId>0</ELELocId>
<ELEBldgOpwnId>0</ELEBldgOpwnId>
<ELERespOwnId>0</ELERespOwnId>
<ELEPassID>0</ELEPassID>
<ELESkiID>0</ELESkiID>
<ELEWclID>0</ELEWclID>
<ELEECOCD_ID>0</ELEECOCD_ID>
<ELEEORIG_ID>0</ELEEORIG_ID>
<FIRST_INSP_ID>0</FIRST_INSP_ID>
<LAST_MAJ_REP_INSP_ID>0</LAST_MAJ_REP_INSP_ID>
</AS400_ELVPEQP00>
<AS400_ELVPEQP00>
<ID>114225</ID>
<DOC_LINK_ID>0</DOC_LINK_ID>
<EMAIL_LINK_ID>0</EMAIL_LINK_ID>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<OBJ_TYPE>AS400_ELVPEQP00</OBJ_TYPE>
<CRTD_DT>0001-01-01T00:00:00</CRTD_DT>
<MODFD_DT>0001-01-01T00:00:00</MODFD_DT>
<SLMR_ERROR_LIST />
<ELBLDGCD>11966</ELBLDGCD>
<ELEEQNO>2</ELEEQNO>
<ELEEQNO_DISPLAY>002</ELEEQNO_DISPLAY>
<ELEDTINY>1947</ELEDTINY>
<ELEDTINM>10</ELEDTINM>
<ELEDTIND>2</ELEDTIND>
<ELEInitInsp_DT>1947-10-02T00:00:00</ELEInitInsp_DT>
<ELEIRSLT>P</ELEIRSLT>
<ELEICDTY>0</ELEICDTY>
<ELEICDTM>0</ELEICDTM>
<ELEICDTD>0</ELEICDTD>
<ELEClear_DT>1900-01-01T00:00:00</ELEClear_DT>
<ELPERMTNO>194703851</ELPERMTNO>
<ELEPERMID>N</ELEPERMID>
<ELEDTISY>0</ELEDTISY>
<ELEDTISM>0</ELEDTISM>
<ELEDTISD>0</ELEDTISD>
<ELEPermitIssued_DT>1900-01-01T00:00:00</ELEPermitIssued_DT>
<ELELSEAL />
<ELEYCEXP>0</ELEYCEXP>
<ELEMCEXP>0</ELEMCEXP>
<ELECEXP_DT>0001-01-01T00:00:00</ELECEXP_DT>
<ELEYCISS>0</ELEYCISS>
<ELEMCISS>0</ELEMCISS>
<ELOFLNUM>11966</ELOFLNUM>
<ELERPNUM>11966</ELERPNUM>
<ELETYPELV>F</ELETYPELV>
<ELEINSPD>2</ELEINSPD>
<ELEDTWINY>0</ELEDTWINY>
<ELEDTWINM>0</ELEDTWINM>
<ELEDTWIND>0</ELEDTWIND>
<ELEMajRepair_DT>1900-01-01T00:00:00</ELEMajRepair_DT>
<ELEWCDTY>0</ELEWCDTY>
<ELEWCDTM>0</ELEWCDTM>
<ELEWCDTD>0</ELEWCDTD>
<ELEMajRepairClear_DT>1900-01-01T00:00:00</ELEMajRepairClear_DT>
<ELEDTLINY>2008</ELEDTLINY>
<ELEDTLINM>2</ELEDTLINM>
<ELEDTLIND>21</ELEDTLIND>
<ELELastInsp_DT>2008-02-21T00:00:00</ELELastInsp_DT>
<ELELAST_INSP_ID>1369887</ELELAST_INSP_ID>
<ELEUPDTYY>0</ELEUPDTYY>
<ELEUPDTMM>0</ELEUPDTMM>
<ELEUPDTDD>0</ELEUPDTDD>
<ELELastUpdate_DT>0001-01-01T00:00:00</ELELastUpdate_DT>
<ELELocId>0</ELELocId>
<ELEBldgOpwnId>0</ELEBldgOpwnId>
<ELERespOwnId>0</ELERespOwnId>
<ELEPassID>0</ELEPassID>
<ELESkiID>0</ELESkiID>
<ELEWclID>0</ELEWclID>
<ELEECOCD_ID>0</ELEECOCD_ID>
<ELEEORIG_ID>0</ELEEORIG_ID>
<FIRST_INSP_ID>0</FIRST_INSP_ID>
<LAST_MAJ_REP_INSP_ID>0</LAST_MAJ_REP_INSP_ID>
</AS400_ELVPEQP00>
</ObjList>
<Sort_Expression />
<Sort_Expression_List />
<Sort_Direction>Asc</Sort_Direction>
<SEARCH_ELBLDGCD>0</SEARCH_ELBLDGCD>
<SEARCH_ELEEQNO>0</SEARCH_ELEEQNO>
<SEARCH_ELEFLNUM>0</SEARCH_ELEFLNUM>
<SEARCH_ELERPNUM>0</SEARCH_ELERPNUM>
<SEARCH_ELPERMTNO>0</SEARCH_ELPERMTNO>
<SEARCH_ELPERMTNO_LIST />
<SEARCH_INSPTRID>0</SEARCH_INSPTRID>
<SEARCH_INSPNDT_START>12:00:00 AM</SEARCH_INSPNDT_START>
<SEARCH_INSPNDT_END>12:00:00 AM</SEARCH_INSPNDT_END>
</AS400_ELVPEQP_COL>
<LastEqpNum>0</LastEqpNum>
<NumOfEqp>0</NumOfEqp>
<PRVNC>0</PRVNC>
<CTRY>0</CTRY>
<DIVN>ELV</DIVN>
<FILE_NUMBER>0</FILE_NUMBER>
<OWNER_ID>0</OWNER_ID>
<Original_ObjType>AS400_ELVPLOC00</Original_ObjType>
<ASGD_WRKLD_INSPTR_ID>0</ASGD_WRKLD_INSPTR_ID>
</AS400_ELVPLOC00>
<AS400_ELVPLOC00>
<ID>0</ID>
<DOC_LINK_ID>0</DOC_LINK_ID>
<EMAIL_LINK_ID>0</EMAIL_LINK_ID>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<OBJ_TYPE>AS400_ELVPLOC00</OBJ_TYPE>
<CRTD_DT>0001-01-01T00:00:00</CRTD_DT>
<MODFD_DT>0001-01-01T00:00:00</MODFD_DT>
<SLMR_ERROR_LIST />
<ELBLDGCD>26778</ELBLDGCD>
<ELBLDGCD_DISPLAY>26778</ELBLDGCD_DISPLAY>
<ELBLDGNM>ANOTHER COMPANY</ELBLDGNM>
<ELLSTNUM />
<ELLDIR>E</ELLDIR>
<ELLRDNUM>0</ELLRDNUM>
<ELLSTNM1>POST</ELLSTNM1>
<ELLTYP1>RD</ELLTYP1>
<ELLCITY>HARRISBURG</ELLCITY>
<ELLSTATE>PA</ELLSTATE>
<ELLZIPCD>17111</ELLZIPCD>
<ELLZIPCD_DISPLAY>19067</ELLZIPCD_DISPLAY>
<ELLZIPSX>0</ELLZIPSX>
<ELLZIPSX_DISPLAY />
<LOC_STREET_DISPLAY>E POST RD</LOC_STREET_DISPLAY>
<LOC_STREET_DISPLAY2> </LOC_STREET_DISPLAY2>
<LOC_DISPLAY_NONUM>ANOTHER COMPANY<br />E POST RD<br />HARRISBURG PA 17111</LOC_DISPLAY_NONUM>
<ELLCNTY>42017</ELLCNTY>
<ELLCNTY_NAME>Bucks</ELLCNTY_NAME>
<ELLCURRYY>0</ELLCURRYY>
<ELLCURRMM>0</ELLCURRMM>
<ELLCURRDD>0</ELLCURRDD>
<ELLCurrStatus_DT>0001-01-01T00:00:00</ELLCurrStatus_DT>
<FEE_CO_ID>0</FEE_CO_ID>
<INSPTR_ID>0</INSPTR_ID>
<ELLUPDTYY>0</ELLUPDTYY>
<ELLUPDTMM>0</ELLUPDTMM>
<ELLUPDTDD>0</ELLUPDTDD>
<ELLLastUpdate_DT>0001-01-01T00:00:00</ELLLastUpdate_DT>
<ELLPASTYY>0</ELLPASTYY>
<ELLPASTMM>0</ELLPASTMM>
<ELLPASTDD>0</ELLPASTDD>
<ELEPastStat_DT>0001-01-01T00:00:00</ELEPastStat_DT>
<AS400_ELVPEQP_COL>
<COL_FILL_MODE>0</COL_FILL_MODE>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<SLMR_ERROR_LIST />
<ObjList>
<AS400_ELVPEQP00>
<ID>77581</ID>
<DOC_LINK_ID>0</DOC_LINK_ID>
<EMAIL_LINK_ID>0</EMAIL_LINK_ID>
<IS_CHANGED>false</IS_CHANGED>
<IS_CHILDREN>true</IS_CHILDREN>
<OBJ_TYPE>AS400_ELVPEQP00</OBJ_TYPE>
<CRTD_DT>0001-01-01T00:00:00</CRTD_DT>
<MODFD_DT>0001-01-01T00:00:00</MODFD_DT>
<SLMR_ERROR_LIST />
<ELBLDGCD>26778</ELBLDGCD>
<ELEEQNO>7</ELEEQNO>
<ELEEQNO_DISPLAY>007</ELEEQNO_DISPLAY>
<ELEDTINY>0</ELEDTINY>
<ELEDTINM>0</ELEDTINM>
<ELEDTIND>0</ELEDTIND>
<ELEInitInsp_DT>1900-01-01T00:00:00</ELEInitInsp_DT>
<ELEIRSLT />
<ELEICDTY>0</ELEICDTY>
<ELEICDTM>0</ELEICDTM>
<ELEICDTD>0</ELEICDTD>
<ELEClear_DT>1900-01-01T00:00:00</ELEClear_DT>
<ELPERMTNO>0</ELPERMTNO>
<ELEPERMID>M0</ELEPERMID>
<ELEDTISY>0</ELEDTISY>
<ELEDTISM>0</ELEDTISM>
<ELEDTISD>0</ELEDTISD>
<ELEPermitIssued_DT>1900-01-01T00:00:00</ELEPermitIssued_DT>
<ELELSEAL />
<ELEYCEXP>0</ELEYCEXP>
<ELEMCEXP>0</ELEMCEXP>
<ELECEXP_DT>0001-01-01T00:00:00</ELECEXP_DT>
<ELEYCISS>0</ELEYCISS>
<ELEMCISS>0</ELEMCISS>
<ELOFLNUM>26778</ELOFLNUM>
<ELERPNUM>26778</ELERPNUM>
<ELETYPELV>F</ELETYPELV>
<ELEINSPD>2</ELEINSPD>
<ELEDTWINY>0</ELEDTWINY>
<ELEDTWINM>0</ELEDTWINM>
<ELEDTWIND>0</ELEDTWIND>
<ELEMajRepair_DT>1900-01-01T00:00:00</ELEMajRepair_DT>
<ELEWCDTY>0</ELEWCDTY>
<ELEWCDTM>0</ELEWCDTM>
<ELEWCDTD>0</ELEWCDTD>
<ELEMajRepairClear_DT>1900-01-01T00:00:00</ELEMajRepairClear_DT>
<ELEDTLINY>2010</ELEDTLINY>
<ELEDTLINM>6</ELEDTLINM>
<ELEDTLIND>3</ELEDTLIND>
<ELELastInsp_DT>2010-06-03T00:00:00</ELELastInsp_DT>
<ELELAST_INSP_ID>1547374</ELELAST_INSP_ID>
<ELEUPDTYY>0</ELEUPDTYY>
<ELEUPDTMM>0</ELEUPDTMM>
<ELEUPDTDD>0</ELEUPDTDD>
<ELELastUpdate_DT>0001-01-01T00:00:00</ELELastUpdate_DT>
<ELELocId>0</ELELocId>
<ELEBldgOpwnId>0</ELEBldgOpwnId>
<ELERespOwnId>0</ELERespOwnId>
<ELEPassID>0</ELEPassID>
<ELESkiID>0</ELESkiID>
<ELEWclID>0</ELEWclID>
<ELEECOCD_ID>0</ELEECOCD_ID>
<ELEEORIG_ID>0</ELEEORIG_ID>
<FIRST_INSP_ID>0</FIRST_INSP_ID>
<LAST_MAJ_REP_INSP_ID>0</LAST_MAJ_REP_INSP_ID>
</AS400_ELVPEQP00>
</ObjList>
<Sort_Expression />
<Sort_Expression_List />
<Sort_Direction>Asc</Sort_Direction>
<SEARCH_ELBLDGCD>0</SEARCH_ELBLDGCD>
<SEARCH_ELEEQNO>0</SEARCH_ELEEQNO>
<SEARCH_ELEFLNUM>0</SEARCH_ELEFLNUM>
<SEARCH_ELERPNUM>0</SEARCH_ELERPNUM>
<SEARCH_ELPERMTNO>0</SEARCH_ELPERMTNO>
<SEARCH_ELPERMTNO_LIST />
<SEARCH_INSPTRID>0</SEARCH_INSPTRID>
<SEARCH_INSPNDT_START>12:00:00 AM</SEARCH_INSPNDT_START>
<SEARCH_INSPNDT_END>12:00:00 AM</SEARCH_INSPNDT_END>
</AS400_ELVPEQP_COL>
<LastEqpNum>0</LastEqpNum>
<NumOfEqp>0</NumOfEqp>
<PRVNC>0</PRVNC>
<CTRY>0</CTRY>
<DIVN>ELV</DIVN>
<FILE_NUMBER>0</FILE_NUMBER>
<OWNER_ID>0</OWNER_ID>
<Original_ObjType>AS400_ELVPLOC00</Original_ObjType>
<ASGD_WRKLD_INSPTR_ID>0</ASGD_WRKLD_INSPTR_ID>
</AS400_ELVPLOC00>
</ObjList>
<Sort_Expression />
<Sort_Expression_List />
<Sort_Direction>Asc</Sort_Direction>
<SEARCH_ELBLDGCD>0</SEARCH_ELBLDGCD>
<SEARCH_ELBLDGNM />
<SEARCH_ELLCITY />
<SEARCH_ELOFLNUM>0</SEARCH_ELOFLNUM>
<SEARCH_ELLSTNAME />
<SEARCH_Counties>42017,42075</SEARCH_Counties>
<SEARCH_FromDate>2011-01-01T00:00:00</SEARCH_FromDate>
<SEARCH_ToDate>2014-06-30T00:00:00</SEARCH_ToDate>
</AS400_ELVPLOC00Collection>
Print_Stylesheet.txt (attribute-sets)
<xsl:attribute-set name="table">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="table-layout">fixed</xsl:attribute>
<xsl:attribute name="space-before">10pt</xsl:attribute>
<xsl:attribute name="space-after">10pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.th" >
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-color">black</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
<xsl:attribute name="padding-start">0.3em</xsl:attribute>
<xsl:attribute name="padding-end">0.2em</xsl:attribute>
<xsl:attribute name="padding-before">2pt</xsl:attribute>
<xsl:attribute name="padding-after">2pt</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.td_title" >
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-color">black</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
<xsl:attribute name="padding-start">0.3em</xsl:attribute>
<xsl:attribute name="padding-end">0.2em</xsl:attribute>
<xsl:attribute name="padding-before">2pt</xsl:attribute>
<xsl:attribute name="padding-after">2pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.td_data" >
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-color">black</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="padding-start">0.5em</xsl:attribute>
<xsl:attribute name="padding-end">0.3em</xsl:attribute>
<xsl:attribute name="padding-before">2pt</xsl:attribute>
<xsl:attribute name="padding-after">2pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table_PLAN_APRVL">
<xsl:attribute name="font-family">Arial</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="line-height">14pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.td_titleCell">
<xsl:attribute name="line-height">10pt</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="padding-start">0.3em</xsl:attribute>
<xsl:attribute name="padding-end">0.2em</xsl:attribute>
<xsl:attribute name="padding-before">1pt</xsl:attribute>
<xsl:attribute name="padding-after">1pt</xsl:attribute>
<xsl:attribute name="border-left-style">solid</xsl:attribute>
<xsl:attribute name="border-left-width">thin</xsl:attribute>
<xsl:attribute name="border-right-style">solid</xsl:attribute>
<xsl:attribute name="border-right-width">thin</xsl:attribute>
<xsl:attribute name="border-top-style">solid</xsl:attribute>
<xsl:attribute name="border-top-width">thin</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.td_innerTitleCell">
<xsl:attribute name="vertical-align">sub</xsl:attribute>
<xsl:attribute name="text-align">right</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="padding-end">0.1em</xsl:attribute>
<xsl:attribute name="padding-before">1pt</xsl:attribute>
<xsl:attribute name="padding-after">1pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="table.data.td_innerCell">
<xsl:attribute name="vertical-align">sub</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="padding-before">1pt</xsl:attribute>
<xsl:attribute name="padding-after">1pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="OCR.Data">
<xsl:attribute name="font-family">OCR A Extended</xsl:attribute>
<xsl:attribute name="font-size">13pt</xsl:attribute>
<xsl:attribute name="font-weight">normal</xsl:attribute>
<xsl:attribute name="font-color">black</xsl:attribute>
</xsl:attribute-set>
Section from XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<!--Style Sheet-->
<!--Helper Tools-->
<xsl:variable name="ind" select="0" />
<xsl:attribute-set name="table.cell">
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-color">black</xsl:attribute>
<xsl:attribute name="border-width">normal</xsl:attribute>
<xsl:attribute name="font-size">7pt</xsl:attribute>
<xsl:attribute name="font-family">Times New Roman</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="padding-before">2pt</xsl:attribute>
<xsl:attribute name="padding-after">2pt</xsl:attribute>
</xsl:attribute-set>
<xsl:key name="county" match="ObjList/AS400_ELVPLOC00" use="ELLCNTY_NAME" />
<xsl:template match="AS400_ELVPLOC00Collection">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="11in"
page-width="8.5in"
margin-top="0.125in"
margin-bottom="0.125in"
margin-left="0.325in"
margin-right="0.325in">
<fo:region-body margin-top="1.125in"
margin-bottom="0.75in"
margin-left="0in"
margin-right="1in"
/>
<fo:region-before region-name="xsl-region-before" extent="1in" />
<fo:region-after region-name="xsl-region-after" extent="0.0in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<!-- Page Header-->
<fo:static-content flow-name="xsl-region-before">
</fo:static-content>
<!--Footer-->
<fo:static-content flow-name="xsl-region-after" >
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="ObjList/AS400_ELVPLOC00[generate-id(.)=generate-id(key('county',ELLCNTY_NAME)[1])]">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="ObjList/AS400_ELVPLOC00[generate-id(.)=generate-id(key('county',ELLCNTY_NAME)[1])]">
<fo:table xsl:use-attribute-sets="table" space-after="0pt" break-after="page">
<fo:table-column column-number="1" column-width="0.75in" />
<!-- LOC NO -->
<fo:table-column column-number="2" column-width="2.85in" />
<!-- LOCATION -->
<fo:table-column column-number="3" column-width="1.5in" />
<!-- EQP/TYPE -->
<fo:table-column column-number="4" column-width="1.25in" />
<!-- INSP DATE -->
<fo:table-column column-number="5" column-width="0.125in" />
<!-- ? -->
<fo:table-column column-number="6" column-width="2.0in" />
<!-- HISTORY -->
<fo:table-header>
<!-- Grid Header -->
<fo:table-row>
<fo:table-cell number-columns-spanned="2">
<fo:block>
<xsl:text>FOR </xsl:text>
<xsl:value-of select="ELLCNTY_NAME" />
<xsl:text> COUNTY</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell number-columns-spanned="4">
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block padding-after="10pt">
LOC NO
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="left">
<fo:block>
LOCATION
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="left">
<fo:block>
EQP/TYPE
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="left">
<fo:block>
INSP DATE
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="left">
<fo:block>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="left">
<fo:block>
HISTORY
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<!-- Table Grid -->
<fo:table-body>
<xsl:for-each select="key('county',ELLCNTY_NAME)">
<xsl:sort select="ELBLDGCD_DISPLAY" />
<fo:table-row padding-after="4pt">
<fo:table-cell>
<fo:block>
<xsl:value-of select="ELBLDGCD_DISPLAY" />
</fo:block>
</fo:table-cell>
<fo:table-cell padding-after="5pt">
<fo:block>
<fo:block>
<xsl:value-of select="ELBLDGNM"/>
</fo:block>
<fo:block>
<xsl:value-of select="LOC_STREET_DISPLAY"/>
</fo:block>
<fo:block>
<xsl:value-of select="ELLCITY"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="ELLSTATE"/>
<xsl:text> </xsl:text>
<xsl:value-of select="ELLZIPCD"/>
</fo:block>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-after="5pt">
<fo:block>
<xsl:text>...</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-after="5pt">
<fo:block>
<xsl:text>...</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-after="5pt">
<fo:block>
<xsl:text>...</xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell padding-after="5pt">
<fo:block>
<xsl:text>...</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
After fixing a few issues in your posted XSL and examining the results, I believe what you want is the whole row in the repeating table is always kept together on a page. If yes, then you would do this in your XSL:
<xsl:for-each select="key('county',ELLCNTY_NAME)">
<xsl:sort select="ELBLDGCD_DISPLAY" />
<fo:table-row padding-after="4pt" keep-together.within-page="always">
You can get the same effect by setting that value on the exact table-cell:
<fo:table-cell padding-after="5pt" keep-together.within-page="always">
<fo:block>
<fo:block>
<xsl:value-of select="ELBLDGNM"/>
</fo:block>
<fo:block>
<xsl:value-of select="LOC_STREET_DISPLAY"/>
</fo:block>
<fo:block>
<xsl:value-of select="ELLCITY"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="ELLSTATE"/>
<xsl:text> </xsl:text>
<xsl:value-of select="ELLZIPCD"/>
</fo:block>
</fo:block>
</fo:table-cell>
Or even the containing block that contains all the lines inside the table cell. The difference would be whether this is the only thing you want kept together or if you want the whole row kept together.
Also note, this has nothing to do with MSXML, that tag should be removed. It is a pure XSL FO keep question and does not matter what XSLT engine you use.
The resulting PDF shows that those cells are not broken from page to page: