1 | <?xml version='1.0' encoding='ISO-8859-1'?> |
---|
2 | |
---|
3 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
4 | xmlns:fo="http://www.w3.org/1999/XSL/Format" |
---|
5 | version="1.0"> |
---|
6 | |
---|
7 | |
---|
8 | <!-- Graphics in admonitions --> |
---|
9 | <xsl:param name="admon.graphics" select="1"/> |
---|
10 | <xsl:param name="admon.graphics.path" |
---|
11 | select="'/usr/share/xml/docbook/xsl-stylesheets-current/images/'"/> |
---|
12 | |
---|
13 | <!-- Admonition block properties --> |
---|
14 | <xsl:template match="important|warning|caution"> |
---|
15 | <xsl:choose> |
---|
16 | <xsl:when test="$admon.graphics != 0"> |
---|
17 | <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em" |
---|
18 | space-before.maximum="0.8em" border-style="solid" border-width="1pt" |
---|
19 | border-color="#500" background-color="#FFFFE6"> |
---|
20 | <xsl:call-template name="graphical.admonition"/> |
---|
21 | </fo:block> |
---|
22 | </xsl:when> |
---|
23 | <xsl:otherwise> |
---|
24 | <xsl:call-template name="nongraphical.admonition"/> |
---|
25 | </xsl:otherwise> |
---|
26 | </xsl:choose> |
---|
27 | </xsl:template> |
---|
28 | |
---|
29 | <xsl:template match="note|tip"> |
---|
30 | <xsl:choose> |
---|
31 | <xsl:when test="$admon.graphics != 0"> |
---|
32 | <fo:block space-before.minimum="0.4em" space-before.optimum="0.6em" |
---|
33 | space-before.maximum="0.8em" border-style="solid" border-width="1pt" |
---|
34 | border-color="#E0E0E0" background-color="#FFFFE6"> |
---|
35 | <xsl:call-template name="graphical.admonition"/> |
---|
36 | </fo:block> |
---|
37 | </xsl:when> |
---|
38 | <xsl:otherwise> |
---|
39 | <xsl:call-template name="nongraphical.admonition"/> |
---|
40 | </xsl:otherwise> |
---|
41 | </xsl:choose> |
---|
42 | </xsl:template> |
---|
43 | |
---|
44 | <!-- Admonitions text properties --> |
---|
45 | <xsl:attribute-set name="admonition.properties"> |
---|
46 | <xsl:attribute name="margin-right">6pt</xsl:attribute> |
---|
47 | </xsl:attribute-set> |
---|
48 | |
---|
49 | <!-- Adding left space to the graphics and color to the titles --> |
---|
50 | <xsl:template name="graphical.admonition"> |
---|
51 | <xsl:variable name="id"> |
---|
52 | <xsl:call-template name="object.id"/> |
---|
53 | </xsl:variable> |
---|
54 | <xsl:variable name="graphic.width"> |
---|
55 | <xsl:apply-templates select="." mode="admon.graphic.width"/> |
---|
56 | </xsl:variable> |
---|
57 | <fo:block id="{$id}"> |
---|
58 | <fo:list-block provisional-distance-between-starts="{$graphic.width} + 18pt" |
---|
59 | provisional-label-separation="18pt" xsl:use-attribute-sets="list.block.spacing"> |
---|
60 | <fo:list-item> |
---|
61 | <fo:list-item-label end-indent="label-end()"> |
---|
62 | <fo:block margin-left="18pt"> |
---|
63 | <fo:external-graphic width="auto" height="auto" |
---|
64 | content-width="{$graphic.width}" > |
---|
65 | <xsl:attribute name="src"> |
---|
66 | <xsl:call-template name="admon.graphic"/> |
---|
67 | </xsl:attribute> |
---|
68 | </fo:external-graphic> |
---|
69 | </fo:block> |
---|
70 | </fo:list-item-label> |
---|
71 | <fo:list-item-body start-indent="body-start()"> |
---|
72 | <xsl:if test="$admon.textlabel != 0 or title"> |
---|
73 | <fo:block xsl:use-attribute-sets="admonition.title.properties"> |
---|
74 | <xsl:if test="ancestor-or-self::important"> |
---|
75 | <xsl:attribute name="color">#500</xsl:attribute> |
---|
76 | </xsl:if> |
---|
77 | <xsl:if test="ancestor-or-self::warning"> |
---|
78 | <xsl:attribute name="color">#500</xsl:attribute> |
---|
79 | </xsl:if> |
---|
80 | <xsl:if test="ancestor-or-self::caution"> |
---|
81 | <xsl:attribute name="color">#500</xsl:attribute> |
---|
82 | </xsl:if> |
---|
83 | <xsl:apply-templates select="." mode="object.title.markup"/> |
---|
84 | </fo:block> |
---|
85 | </xsl:if> |
---|
86 | <fo:block xsl:use-attribute-sets="admonition.properties"> |
---|
87 | <xsl:apply-templates/> |
---|
88 | </fo:block> |
---|
89 | </fo:list-item-body> |
---|
90 | </fo:list-item> |
---|
91 | </fo:list-block> |
---|
92 | </fo:block> |
---|
93 | </xsl:template> |
---|
94 | |
---|
95 | </xsl:stylesheet> |
---|