tools/boostbook/xsl/fo.xsl
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <!-- Import the FO stylesheet --> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> <xsl:param name="chapter.autolabel" select="0"/> <xsl:param name="refentry.generate.name" select="0"/> <xsl:param name="refentry.generate.title" select="1"/> <xsl:param name="fop.extensions" select="1"/> <xsl:param name="make.year.ranges" select="1"/> <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>