#404 inserting page background image

open
nobody
XSL (399)
5
2008-02-11
2008-02-11
Antti Karanta
No

ATM inserting a page background image requires using custom page masters. This seems like a lot of hassle to just insert a couple of attributes.

It would be great if there was a user overridable template (w/ empty default implementation) used something like this (in fo/pagesetup.xsl where the default page masters are defined):

<fo:simple-page-master master-name="blank"
page-width="{$page.width}"
page-height="{$page.height}"
margin-top="{$page.margin.top}"
margin-bottom="{$page.margin.bottom}"
margin-left="{$margin.left.outer}"
margin-right="{$page.margin.inner}">
<xsl:if test="$axf.extensions != 0">
<xsl:call-template name="axf-page-master-properties">
<xsl:with-param name="page.master">blank</xsl:with-param>
</xsl:call-template>
</xsl:if>
<fo:region-body display-align="center"
margin-bottom="{$body.margin.bottom}"
margin-top="{$body.margin.top}">
<xsl:if test="$fop.extensions = 0 and $fop1.extensions = 0">
<xsl:attribute name="region-name">blank-body</xsl:attribute>
</xsl:if>

<!-- if this was actually here it would be easy to insert background images: -->
<!-- The same call could naturally be made in region-before and region-after -->
<xsl:call-template name="user.page.region">
<xsl:with-param name="master-name" select="'blank'"/>
<xsl:with-param name="location" select="'region-body'"/>
</xsl:call-template>
<!-- end my insertion -->

</fo:region-body>
<fo:region-before region-name="xsl-region-before-blank"
extent="{$region.before.extent}"
display-align="before"/>
<fo:region-after region-name="xsl-region-after-blank"
extent="{$region.after.extent}"
display-align="after"/>
</fo:simple-page-master>

...
<!-- default implementation of this template -->
<xsl:template name="user.page.region"/>

Note that page background images are defined in fo by a group of related attributes in fo:region-body.

Discussion