Reputation: 145
I'm looking at a legacy XSL-FO file.
Currently, it would print the name at the lower left corner. Does anyone know how to modify the below code so that the the name appears in the body part?
I'm confused about a few things:
1) inside the simple-page-master,
Why are there these two code sniplets, both region-body and region-after?
<fo:region-body/>
<fo:region-after extent="1in"/>
Which is being used?? Evidently, the region-after is being used.
2) Is the value to flow-name just any old string or is it very specific and have meaning? I changed the name to xsl-region-blah and there's an error, so that tells me it's very specific
<fo:static-content flow-name="xsl-region-after"
However, I don't understand how the above code comes into play because according to RenderX's tutorial, if the page-sequence master-reference points to the page master, then the flow would come from the page master, for example,
<fo:page-sequence master-reference="Mail">
points to Mail, so it would reference this:
<fo:simple-page-master margin-left="1in" margin-right=".5in" margin-top=".5in"
page-width="8.5in" page-height="11in" master-name="Mail">
<fo:region-body/>
<fo:region-after extent="1.6in"/>
</fo:simple-page-master>
and that page master uses either region-body or region-after. What I'm not getting is, which one is it using, body or after?
The below code belongs to a much larger xsl-fo 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 version="1.0" method="xml" omit-xml-declaration="no" indent="yes"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master margin-left=".5in" margin-right=".5in" margin-top=".5in" margin-bottom=".5in"
page-width="8.5in" page-height="11in" master-name="PickUp">
<fo:region-body/>
<fo:region-after extent="1in"/>
</fo:simple-page-master>
<fo:simple-page-master margin-left="1in" margin-right=".5in" margin-top=".5in"
page-width="8.5in" page-height="11in" master-name="Mail">
<fo:region-body/>
<fo:region-after extent="1.6in"/>
</fo:simple-page-master>
<fo:simple-page-master margin-left=".5in" margin-right=".5in" margin-top=".5in" margin-bottom=".5in"
page-width="8.5in" page-height="11in" master-name="Fax">
<fo:region-body/>
<fo:region-after/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:for-each select="transactionItemList/transactionItems">
<xsl:if test="deliveryInfo/deliveryMethod/type='Mail'">
<fo:page-sequence master-reference="Mail">
<fo:static-content flow-name="xsl-region-after" font-size="9pt" font-family="Univers Medium">
<fo:block-container>
<fo:table>
<fo:table-column column-number="1"/>
<fo:table-body>
<fo:table-row text-align="left" height="1in">
<fo:table-cell display-align="center">
<fo:block >
Person who ordered transcript:
</fo:block>
<fo:block >
Firstname: <xsl:value-of select="studentFirstName"/>
</fo:block>
<fo:block>
Lastname: <xsl:value-of select="studentLastName"/>
</fo:block>
...
...
...
Thanks in advance for your help. BTW, I did change region-after to region-body but it won't work because it mentions there's duplicate region-body. I removed the region-after, and I get an error.
Upvotes: 1
Views: 2923
Reputation: 7905
It seems worth reading a little bit of the latest XSL-FO specification.
You can avoid reading it fully, here are the key parts for your questions: regarding <fo:region-body>
or <fo:region-after>
, see §6.4.13 fo:simple-page-master, which explains and depicts the page layout model.
To answer your questions :
Basically, the region-body
is the main part of your document, and the region-after
will be the footer (similarly, you will have a region-before
which corresponds to the header). The elements you find here are aimed to set properties (margins, borders, ...) to the regions of the pages where text can be output. The page-master are here to define the global paging properties of your documents.
Yes the xsl-region-after
is a predefined name (as far as I remember these names can be redefined, but xsl-region-after
, amongst others, is a default one that can be directly used). See §6.4.1.4 Flows and Flow Mapping of the specification mentioned above for the details.
Finally: to solve you problem and insert the "name" in the body part, you need to insert it in the <fo:flow flow-name="xsl-region-body">
you will find after the sequence of <fo:static flow-name="....">
.
Upvotes: 1
Reputation: 3788
In an FO file, the fo:layout-master-set
section defines the page geometry:
fo:simple-page-master
describes one type of page: width, height, margins and most importantly the page regions where some content can be placed;fo:page-sequence-master
allows to define how different fo:simple-page-master
s must be used to create the pages (for example alternating between odd pages and even pages, with different margins and regions).The fo:page-sequence
elements define the content:
fo:static-content
defines a piece of content that is placed inside a side region, and repeated in every page having that region (fo:page-number
and fo:retrieve-marker
can be used to insert dynamic content);fo:flow
defines the main content to be paginated.Each fo:page-sequence
refers to a page master, and its fo:static-content
s and fo:flow
are mapped (either explicitly or relying on default values) to a specific region.
Your page layout defines two regions, named xsl-region-body
and xsl-region-after
(these are the default names); the main content, inside fo:flow
, is mapped to xsl-region-body
, while the static content defining some kind of header is mapped to xsl-region-after
.
If you want the old "page header" to appear just once before the main content instead of being repeated at the top of each page, you have to delete the fo:static-content
, moving its content inside the fo:flow
before the existing elements.
You will have something like this:
<fo:page-sequence master-reference="Mail">
<fo:flow flow-name="xsl-region-body" font-size="9pt" font-family="Univers Medium">
<!-- content moved from the old static content -->
<fo:block-container>
<fo:table>
<fo:table-column column-number="1"/>
<fo:table-body>
<fo:table-row text-align="left" height="1in">
<fo:table-cell display-align="center">
<fo:block >
Person who ordered transcript:
</fo:block>
...
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block-container>
<!-- the old flow content -->
...
</fo:flow>
</fo:page-sequence>
Upvotes: 3