Static and flow
Okay, I am getting a little perturbed at XSL book authors, and I will tell you when I get to my Daily Gripes section. For now, let me just say that this latest gripe centers on the use of static and flow inside a document.
Here is the code I am working with right now, which does not work.
<xsl:template match=”/”>
<fo:root>
<!– layout-master (page setup) –><fo:layout-master-set>
<fo:simple-page-master master-name=”body”>
<fo:region-body region-name=”portrait” margin-top=”20pt”/>
<fo:region-after region-name=”xsl-region-after” extent=”20pt”/>
</fo:simple-page-master>
</fo:layout-master-set><!– page sequence (containts page content) –>
<fo:page-sequence master-reference=”body”>
<fo:flow flow-name=”portrait”>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
<fo:static-content flow-name=”xsl-region-after”>
<fo:block>
Text
</fo:block>
</fo:static-content></fo:page-sequence>
</fo:root>
</xsl:template>
Why doesn’t this work? Apparently, piling the static content into the footer (called “xsl-region-after” in the above code) after having flowed content into the region body (”portrait”) is a no-no. The compiler complains “Static content… is not allowed after <fo:flow>. Neither of the two books I am referring to currently mention this.
Instead, the page-sequence section of the code needs to be something like this:
<fo:page-sequence master-reference=”body”>
<fo:static-content flow-name=”xsl-region-after”>
<fo:block>
Text
</fo:block>
</fo:static-content>
<fo:flow flow-name=”portrait”>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
Now why does the static have to come before the flow? Not so sure yet.
I have learned another lesson the hard way: Nothing is going to happen unless the XSL template specifies some flow. I initially thought I could mock up a blank PDF template with a filled footer by removing the <fo:flow> call altogether, but no dice. No flow equates to “This program cannot display the webpage.” (We can remove the content between the <fo:block> calls and that would work fine, but we cannot remove the FO blocks altogether. No work-ee.