I’m trying to create a custom processing
instruction to
insert and format a background image in a chapter abstract. I’ve
followed the
instructions in Chapter 9 of DocBook XSL TDG but am getting error
messages
about empty parameters.
The XML is:
<abstract>
<?dbfo bgimage="images/Box5-4.gif"?>
<?dbfo bgposition="50% 30%"?>
<?dbfo bgwidth="170mm"?>
<title>Chapter 1 overview</title>
<para>The text in … </para>
</abstract>
</info>
(I'd like to combine all three params into one
pi if possible.)
I’ve set up variables for background-image,
content-width
and position:
<xsl:template match="d:abstract" mode="chapter.titlepage.recto.auto.mode">
<xsl:variable name="bgimage">
<xsl:call-template name="dbfo-attribute">
<xsl:with-param name="pis"
select="ancestor-or-self::d:abstract/processing-instruction('dbfo')"/>
<xsl:with-param name="attribute" select="'background-image'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="bgwidth">
<xsl:call-template name="dbfo-attribute">
<xsl:with-param name="pis"
select="ancestor-or-self::d:abstract/processing-instruction('dbfo')"/>
<xsl:with-param name="attribute" select="'ex:background-content-width'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="bgposition">
<xsl:call-template name="dbfo-attribute">
<xsl:with-param name="pis"
select="ancestor-or-self::d:abstract/processing-instruction('dbfo')"/>
<xsl:with-param name="attribute" select="'background-position'"/>
</xsl:call-template>
</xsl:variable>
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ex="http://www.renderx.com/XSL/Extensions"
xsl:use-attribute-sets="chapsummaryprops"
background-image="{$bgimage}"
ex:background-content-width="{$bgwidth}"
background-position="{$bgposition}">
<xsl:apply-templates select="d:title" />
<xsl:apply-templates select="d:para" />
<!--<xsl:apply-templates
select="."
mode="chapter.titlepage.recto.mode"/>-->
</fo:block>
</xsl:template>
And when I process it with Saxon 6.5.5 the
error messages
are:
[warning]
Attribute 'background-image'
cannot have a value of "": should be either 'inherit' or a URI:
background-image="url(...)".
[error] Attribute
'rx:background-content-width' cannot have a value of "".
I’m using DB 1.77.1, XEP 4.19.
Thanks
--
Dave Gardiner