[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: Duplex printing - how to pad with blank pages
Bob Stayton <bobs <at> sagehill.net> writes:
>
> Hi John,
> Profiling does not apply to processing instructions, as a PI has no
> attributes to select from. You'd have to create a special element such as
> an empty para with role="pagebreak" for that.
>
> Bob Stayton
> Sagehill Enterprises
I have an XML file that looks like this:
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
<title>Conditional Hard Page Breaks</title>
<chapter>
<title>Blank Pages</title>
<para>This is a paragraph</para>
<?hard-pagebreak?>
<para condition="break-needed">
<?hard-pagebreak?>
</para>
<para>This paragraph always begins on a new page, thanks to the
unconditional hard page break. If profile.condition =
break-needed, then a blank page will be inserted. What I
really want is that the extra page break should be inserted
when double.sided=1.
</para>
</chapter>
</book>
I can process this with:
xsltproc -o break.fo --stringparam profile.condition break-needed \
break.xsl break.xml
where break.xsl imports fo/profile-docbook.xsl and defines the hard
page break PI. The only thing is that I would rather not have to
remember to set profile.condition=break-needed when I set double.sided=1.
I want my PI to add one page break or two depending on the value
of double.sided.
I tried this:
<xsl:import href="/path/to/non-profiling/fo/docbook.xsl/>
<xsl:template match="processing-instruction('hard-pagebreak')">
<!-- always start new page -->
<fo:block break-after="page"/>
<xsl:if test="double.sided=1"> <!-- add blank page -->
<fo:block break-after="page"/>
</xsl:if>
</xsl:template>
I know that the test for double.sided works, because I have no problems
when double.sided = 0, but when it is 1, then fop gives errors:
java.lang.UnsupportedOperationException: Flow "xsl-region-body" does not map to
the region-body in page-master "blank". FOP presently does not support this.
(See position 2:458). The relevant section of the fo file is:
<fo:simple-page-master master-name="blank" page-width="8.5in" page-height="11in"
margin-top="0.5in" margin-bottom="0.5in" margin-left="0.75in - 0pt"
margin-right="1.25in">
<fo:region-body display-align="center" margin-bottom="0.5in"
margin-top="0.5in" region-name="blank-body"/>
...
</fo:region-body>
...
</fo:simple-page-master>
2:458 is where the <fo:region-body> tag starts.
Is it possible for me to do what I want?
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]