mirror of
https://github.com/boostorg/boostbook.git
synced 2025-05-11 05:13:58 +00:00
Fix some PDF generation problems with FOP
[SVN r19755]
This commit is contained in:
parent
4c051eba0c
commit
aed848ebd8
103
xsl/fo.xsl
103
xsl/fo.xsl
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
<!-- Import the FO stylesheet -->
|
<!-- Import the FO stylesheet -->
|
||||||
@ -12,4 +13,106 @@
|
|||||||
<xsl:param name="fop.extensions" select="1"/>
|
<xsl:param name="fop.extensions" select="1"/>
|
||||||
<xsl:param name="make.year.ranges" select="1"/>
|
<xsl:param name="make.year.ranges" select="1"/>
|
||||||
<xsl:param name="ulink.show" select="0"/>
|
<xsl:param name="ulink.show" select="0"/>
|
||||||
|
|
||||||
|
<!-- The question and answer templates are copied here from the
|
||||||
|
1.61.3 DocBook XSL stylesheets so that we can eliminate the emission
|
||||||
|
of id attributes in the emitted fo:list-item-label elements. FOP
|
||||||
|
0.20.5 has problems with these id attributes, and they are otherwise
|
||||||
|
unused. -->
|
||||||
|
<xsl:template match="question">
|
||||||
|
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
||||||
|
|
||||||
|
<xsl:variable name="entry.id">
|
||||||
|
<xsl:call-template name="object.id">
|
||||||
|
<xsl:with-param name="object" select="parent::*"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:variable name="deflabel">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
|
||||||
|
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
|
||||||
|
/@defaultlabel"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$qanda.defaultlabel"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing">
|
||||||
|
<fo:list-item-label end-indent="label-end()">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$deflabel = 'none'">
|
||||||
|
<fo:block/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<fo:block>
|
||||||
|
<xsl:apply-templates select="." mode="label.markup"/>
|
||||||
|
<xsl:text>.</xsl:text> <!-- FIXME: Hack!!! This should be in the locale! -->
|
||||||
|
</fo:block>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</fo:list-item-label>
|
||||||
|
<fo:list-item-body start-indent="body-start()">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$deflabel = 'none'">
|
||||||
|
<fo:block font-weight="bold">
|
||||||
|
<xsl:apply-templates select="*[local-name(.)!='label']"/>
|
||||||
|
</fo:block>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:apply-templates select="*[local-name(.)!='label']"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</fo:list-item-body>
|
||||||
|
</fo:list-item>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="answer">
|
||||||
|
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
|
||||||
|
<xsl:variable name="entry.id">
|
||||||
|
<xsl:call-template name="object.id">
|
||||||
|
<xsl:with-param name="object" select="parent::*"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:variable name="deflabel">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
|
||||||
|
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
|
||||||
|
/@defaultlabel"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$qanda.defaultlabel"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<fo:list-item xsl:use-attribute-sets="list.item.spacing">
|
||||||
|
<fo:list-item-label end-indent="label-end()">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$deflabel = 'none'">
|
||||||
|
<fo:block/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<fo:block>
|
||||||
|
<!-- FIXME: Hack!!! This should be in the locale! -->
|
||||||
|
<xsl:variable name="answer.label">
|
||||||
|
<xsl:apply-templates select="." mode="label.markup"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:copy-of select="$answer.label"/>
|
||||||
|
<xsl:if test="string($answer.label) != ''">
|
||||||
|
<xsl:text>.</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</fo:block>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</fo:list-item-label>
|
||||||
|
<fo:list-item-body start-indent="body-start()">
|
||||||
|
<xsl:apply-templates select="*[local-name(.)!='label']"/>
|
||||||
|
</fo:list-item-body>
|
||||||
|
</fo:list-item>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user