1+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2+ xmlns:xslthl="http://xslthl.sf.net" xmlns:d="http://docbook.org/ns/docbook"
3+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
4+ exclude-result-prefixes="xslthl" version="1.0">
5+
6+ <xsl:import href="urn:docbkx:stylesheet" />
7+
8+ <xsl:param name="generate.toc">
9+ appendix toc,title
10+ article/appendix nop
11+ article toc,title
12+ book toc,title
13+ chapter toc,title
14+ part toc,title
15+ preface toc,title
16+ qandadiv toc
17+ qandaset toc
18+ reference toc,title
19+ sect1 toc
20+ sect2 toc
21+ sect3 toc
22+ sect4 toc
23+ sect5 toc
24+ section toc
25+ set toc,title
26+ </xsl:param>
27+
28+ <!--
29+ Graphics
30+ -->
31+ <!-- graphicsize.extension only relevant for html output -->
32+ <!--
33+ <xsl:param name="graphicsize.extension">1</xsl:param>
34+ -->
35+ <xsl:param name="default.image.width">6.3in</xsl:param>
36+ <xsl:param name="default.inline.image.height">...</xsl:param>
37+ <xsl:template name="process.image">
38+ <!-- if image is wider than the page, shrink it down to default.image.width -->
39+ <xsl:variable name="scalefit">
40+ <xsl:choose>
41+ <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
42+ <xsl:when test="@contentwidth">0</xsl:when>
43+ <xsl:when test="@contentdepth and @contentdepth != '100%'">0</xsl:when>
44+ <xsl:when test="@scale">0</xsl:when>
45+ <xsl:when test="@scalefit">
46+ <xsl:value-of select="@scalefit"/>
47+ </xsl:when>
48+ <xsl:when test="@width or @depth">1</xsl:when>
49+ <xsl:otherwise>0</xsl:otherwise>
50+ </xsl:choose>
51+ </xsl:variable>
52+ <xsl:variable name="scale">
53+ <xsl:choose>
54+ <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
55+ <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
56+ <xsl:when test="@scale">
57+ <xsl:value-of select="@scale div 100.0"/>
58+ </xsl:when>
59+ <xsl:otherwise>1.0</xsl:otherwise>
60+ </xsl:choose>
61+ </xsl:variable>
62+ <xsl:variable name="filename">
63+ <xsl:choose>
64+ <xsl:when test="local-name(.) = 'graphic' or local-name(.) = 'inlinegraphic'">
65+ <xsl:call-template name="mediaobject.filename">
66+ <xsl:with-param name="object" select="."/>
67+ </xsl:call-template>
68+ </xsl:when>
69+ <xsl:otherwise>
70+ <xsl:call-template name="mediaobject.filename">
71+ <xsl:with-param name="object" select=".."/>
72+ </xsl:call-template>
73+ </xsl:otherwise>
74+ </xsl:choose>
75+ </xsl:variable>
76+ <xsl:variable name="content-type">
77+ <xsl:if test="@format">
78+ <xsl:call-template name="graphic.format.content-type">
79+ <xsl:with-param name="format" select="@format"/>
80+ </xsl:call-template>
81+ </xsl:if>
82+ </xsl:variable>
83+ <xsl:variable name="bgcolor">
84+ <xsl:call-template name="pi.dbfo_background-color">
85+ <xsl:with-param name="node" select=".."/>
86+ </xsl:call-template>
87+ </xsl:variable>
88+ <fo:external-graphic>
89+ <xsl:attribute name="src">
90+ <xsl:call-template name="fo-external-image">
91+ <xsl:with-param name="filename">
92+ <xsl:if test="$img.src.path != '' and not(starts-with($filename, '/')) and not(contains($filename, '://'))">
93+ <xsl:value-of select="$img.src.path"/>
94+ </xsl:if>
95+ <xsl:value-of select="$filename"/>
96+ </xsl:with-param>
97+ </xsl:call-template>
98+ </xsl:attribute>
99+ <xsl:attribute name="width">
100+ <xsl:choose>
101+ <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
102+ <xsl:when test="contains(@width,'%')">
103+ <xsl:value-of select="@width"/>
104+ </xsl:when>
105+ <xsl:when test="@width and not(@width = '')">
106+ <xsl:call-template name="length-spec">
107+ <xsl:with-param name="length" select="@width"/>
108+ <xsl:with-param name="default.units" select="'px'"/>
109+ </xsl:call-template>
110+ </xsl:when>
111+ <xsl:when test="not(@depth) and name(../..) != 'inlinemediaobject' and $default.image.width != ''">
112+ <xsl:call-template name="length-spec">
113+ <xsl:with-param name="length" select="$default.image.width"/>
114+ <xsl:with-param name="default.units" select="'px'"/>
115+ </xsl:call-template>
116+ </xsl:when>
117+ <xsl:otherwise>auto</xsl:otherwise>
118+ </xsl:choose>
119+ </xsl:attribute>
120+ <xsl:attribute name="height">
121+ <xsl:choose>
122+ <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
123+ <xsl:when test="contains(@depth,'%')">
124+ <xsl:value-of select="@depth"/>
125+ </xsl:when>
126+ <xsl:when test="@depth">
127+ <xsl:call-template name="length-spec">
128+ <xsl:with-param name="length" select="@depth"/>
129+ <xsl:with-param name="default.units" select="'px'"/>
130+ </xsl:call-template>
131+ </xsl:when>
132+ <xsl:when test="name(../..) = 'inlinemediaobject' and $default.inline.image.height != ''">
133+ <xsl:call-template name="length-spec">
134+ <xsl:with-param name="length" select="$default.inline.image.height"/>
135+ <xsl:with-param name="default.units" select="'px'"/>
136+ </xsl:call-template>
137+ </xsl:when>
138+ <xsl:otherwise>auto</xsl:otherwise>
139+ </xsl:choose>
140+ </xsl:attribute>
141+ <xsl:attribute name="content-width">
142+ <xsl:choose>
143+ <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
144+ <xsl:when test="contains(@contentwidth,'%')">
145+ <xsl:value-of select="@contentwidth"/>
146+ </xsl:when>
147+ <xsl:when test="@contentwidth">
148+ <xsl:call-template name="length-spec">
149+ <xsl:with-param name="length" select="@contentwidth"/>
150+ <xsl:with-param name="default.units" select="'px'"/>
151+ </xsl:call-template>
152+ </xsl:when>
153+ <xsl:when test="number($scale) != 1.0">
154+ <xsl:value-of select="$scale * 100"/>
155+ <xsl:text>%</xsl:text>
156+ </xsl:when>
157+ <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
158+ <xsl:otherwise>scale-down-to-fit</xsl:otherwise>
159+ </xsl:choose>
160+ </xsl:attribute>
161+ <xsl:attribute name="content-height">
162+ <xsl:choose>
163+ <xsl:when test="$ignore.image.scaling != 0">auto</xsl:when>
164+ <xsl:when test="contains(@contentdepth,'%')">
165+ <xsl:value-of select="@contentdepth"/>
166+ </xsl:when>
167+ <xsl:when test="@contentdepth">
168+ <xsl:call-template name="length-spec">
169+ <xsl:with-param name="length" select="@contentdepth"/>
170+ <xsl:with-param name="default.units" select="'px'"/>
171+ </xsl:call-template>
172+ </xsl:when>
173+ <xsl:when test="number($scale) != 1.0">
174+ <xsl:value-of select="$scale * 100"/>
175+ <xsl:text>%</xsl:text>
176+ </xsl:when>
177+ <xsl:when test="$scalefit = 1">scale-to-fit</xsl:when>
178+ <xsl:otherwise>scale-down-to-fit</xsl:otherwise>
179+ </xsl:choose>
180+ </xsl:attribute>
181+ <xsl:if test="$content-type != ''">
182+ <xsl:attribute name="content-type">
183+ <xsl:value-of select="concat('content-type:',$content-type)"/>
184+ </xsl:attribute>
185+ </xsl:if>
186+ <xsl:if test="$bgcolor != ''">
187+ <xsl:attribute name="background-color">
188+ <xsl:value-of select="$bgcolor"/>
189+ </xsl:attribute>
190+ </xsl:if>
191+ <xsl:if test="@align">
192+ <xsl:attribute name="text-align">
193+ <xsl:value-of select="@align"/>
194+ </xsl:attribute>
195+ </xsl:if>
196+ <xsl:if test="@valign">
197+ <xsl:attribute name="display-align">
198+ <xsl:choose>
199+ <xsl:when test="@valign = 'top'">before</xsl:when>
200+ <xsl:when test="@valign = 'middle'">center</xsl:when>
201+ <xsl:when test="@valign = 'bottom'">after</xsl:when>
202+ <xsl:otherwise>auto</xsl:otherwise>
203+ </xsl:choose>
204+ </xsl:attribute>
205+ </xsl:if>
206+ </fo:external-graphic>
207+ <!-- </xsl:template> -->
208+
209+ <!-- Add any other template overrides here -->
210+
211+ </xsl:stylesheet>
0 commit comments