Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/boostbook/xsl/fo.xsl @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.3 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright 2003 Douglas Gregor -->
3<!-- Distributed under the Boost Software License, Version 1.0. -->
4<!-- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -->
5
6<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7                xmlns:fo="http://www.w3.org/1999/XSL/Format"
8                version="1.0">
9
10  <!-- Import the FO stylesheet -->
11  <xsl:import 
12    href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
13
14  <xsl:param name="chapter.autolabel" select="0"/>
15  <xsl:param name="refentry.generate.name" select="0"/>
16  <xsl:param name="refentry.generate.title" select="1"/>
17  <xsl:param name="fop.extensions" select="1"/>
18  <xsl:param name="make.year.ranges" select="1"/>
19  <xsl:param name="ulink.show" select="0"/>
20
21  <!-- The question and answer templates are copied here from the
22       1.61.3 DocBook XSL stylesheets so that we can eliminate the emission
23       of id attributes in the emitted fo:list-item-label elements. FOP
24       0.20.5 has problems with these id attributes, and they are otherwise
25       unused. -->
26<xsl:template match="question">
27  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
28
29  <xsl:variable name="entry.id">
30    <xsl:call-template name="object.id">
31      <xsl:with-param name="object" select="parent::*"/>
32    </xsl:call-template>
33  </xsl:variable>
34
35  <xsl:variable name="deflabel">
36    <xsl:choose>
37      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
38        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
39                              /@defaultlabel"/>
40      </xsl:when>
41      <xsl:otherwise>
42        <xsl:value-of select="$qanda.defaultlabel"/>
43      </xsl:otherwise>
44    </xsl:choose>
45  </xsl:variable>
46
47  <fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing">
48    <fo:list-item-label end-indent="label-end()">
49      <xsl:choose>
50        <xsl:when test="$deflabel = 'none'">
51          <fo:block/>
52        </xsl:when>
53        <xsl:otherwise>
54          <fo:block>
55            <xsl:apply-templates select="." mode="label.markup"/>
56            <xsl:text>.</xsl:text> <!-- FIXME: Hack!!! This should be in the locale! -->
57          </fo:block>
58        </xsl:otherwise>
59      </xsl:choose>
60    </fo:list-item-label>
61    <fo:list-item-body start-indent="body-start()">
62      <xsl:choose>
63        <xsl:when test="$deflabel = 'none'">
64          <fo:block font-weight="bold">
65            <xsl:apply-templates select="*[local-name(.)!='label']"/>
66          </fo:block>
67        </xsl:when>
68        <xsl:otherwise>
69          <xsl:apply-templates select="*[local-name(.)!='label']"/>
70        </xsl:otherwise>
71      </xsl:choose>
72    </fo:list-item-body>
73  </fo:list-item>
74</xsl:template>
75
76<xsl:template match="answer">
77  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
78  <xsl:variable name="entry.id">
79    <xsl:call-template name="object.id">
80      <xsl:with-param name="object" select="parent::*"/>
81    </xsl:call-template>
82  </xsl:variable>
83
84  <xsl:variable name="deflabel">
85    <xsl:choose>
86      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
87        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
88                              /@defaultlabel"/>
89      </xsl:when>
90      <xsl:otherwise>
91        <xsl:value-of select="$qanda.defaultlabel"/>
92      </xsl:otherwise>
93    </xsl:choose>
94  </xsl:variable>
95
96  <fo:list-item xsl:use-attribute-sets="list.item.spacing">
97    <fo:list-item-label end-indent="label-end()">
98      <xsl:choose>
99        <xsl:when test="$deflabel = 'none'">
100          <fo:block/>
101        </xsl:when>
102        <xsl:otherwise>
103          <fo:block>
104            <!-- FIXME: Hack!!! This should be in the locale! -->
105            <xsl:variable name="answer.label">
106              <xsl:apply-templates select="." mode="label.markup"/>
107            </xsl:variable>
108            <xsl:copy-of select="$answer.label"/>
109            <xsl:if test="string($answer.label) != ''">
110              <xsl:text>.</xsl:text>
111            </xsl:if>
112          </fo:block>
113        </xsl:otherwise>
114      </xsl:choose>
115    </fo:list-item-label>
116    <fo:list-item-body start-indent="body-start()">
117      <xsl:apply-templates select="*[local-name(.)!='label']"/>
118    </fo:list-item-body>
119  </fo:list-item>
120</xsl:template>
121
122</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.