1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                xmlns:fo="http://www.w3.org/1999/XSL/Format"
4                version='1.0'>
5
6<!-- ********************************************************************
7     $Id$
8     ********************************************************************
9
10     This file is part of the XSL DocBook Stylesheet distribution.
11     See /README or http://nwalsh.com/docbook/xsl/ for copyright
12     and other information.
13
14     ******************************************************************** -->
15
16<xsl:template match="note|important|warning|caution|tip">
17  <xsl:choose>
18    <xsl:when test="$admon.graphics != 0">
19      <xsl:call-template name="graphical.admonition"/>
20    </xsl:when>
21    <xsl:otherwise>
22      <xsl:call-template name="nongraphical.admonition"/>
23    </xsl:otherwise>
24  </xsl:choose>
25</xsl:template>
26
27<xsl:template name="admon.graphic.width">
28  <xsl:param name="node" select="."/>
29  <xsl:text>36pt</xsl:text>
30</xsl:template>
31
32<xsl:template name="admon.graphic">
33  <xsl:param name="node" select="."/>
34  <xsl:value-of select="$admon.graphics.path"/>
35  <xsl:choose>
36    <xsl:when test="name($node)='note'">note</xsl:when>
37    <xsl:when test="name($node)='warning'">warning</xsl:when>
38    <xsl:when test="name($node)='caution'">caution</xsl:when>
39    <xsl:when test="name($node)='tip'">tip</xsl:when>
40    <xsl:when test="name($node)='important'">important</xsl:when>
41    <xsl:otherwise>note</xsl:otherwise>
42  </xsl:choose>
43  <xsl:value-of select="$admon.graphics.extension"/>
44</xsl:template>
45
46<xsl:template name="graphical.admonition">
47  <xsl:variable name="id">
48    <xsl:call-template name="object.id"/>
49  </xsl:variable>
50
51  <fo:block id="{$id}">
52    <fo:table>
53      <fo:table-body>
54        <fo:table-row>
55          <fo:table-cell number-rows-spanned="2">
56            <fo:block>
57              <fo:external-graphic width="auto" height="auto">
58                <xsl:attribute name="src">
59                  <xsl:call-template name="admon.graphic"/>
60                </xsl:attribute>
61                <xsl:attribute name="content-width">
62                  <xsl:call-template name="admon.graphic.width"/>
63                </xsl:attribute>
64              </fo:external-graphic>
65            </fo:block>
66          </fo:table-cell>
67          <fo:table-cell>
68            <fo:block>
69              <xsl:apply-templates select="." mode="object.title.markup"/>
70            </fo:block>
71          </fo:table-cell>
72        </fo:table-row>
73        <fo:table-row>
74          <fo:table-cell number-columns-spanned="2">
75            <fo:block>
76              <xsl:apply-templates/>
77            </fo:block>
78          </fo:table-cell>
79        </fo:table-row>
80      </fo:table-body>
81    </fo:table>
82  </fo:block>
83</xsl:template>
84
85<xsl:template name="nongraphical.admonition">
86  <xsl:variable name="id">
87    <xsl:call-template name="object.id"/>
88  </xsl:variable>
89
90  <fo:block space-before.minimum="0.8em"
91            space-before.optimum="1em"
92            space-before.maximum="1.2em"
93            start-indent="0.25in"
94            end-indent="0.25in"
95            id="{$id}">
96    <fo:block font-size="14pt" font-weight="bold" keep-with-next='always'>
97      <xsl:apply-templates select="." mode="object.title.markup"/>
98    </fo:block>
99
100    <xsl:apply-templates/>
101  </fo:block>
102</xsl:template>
103
104<xsl:template match="note/title"></xsl:template>
105<xsl:template match="important/title"></xsl:template>
106<xsl:template match="warning/title"></xsl:template>
107<xsl:template match="caution/title"></xsl:template>
108<xsl:template match="tip/title"></xsl:template>
109
110<xsl:template match="title" mode="admonition.title.mode">
111  <fo:block font-size="14pt" font-weight="bold" keep-with-next='always'>
112    <xsl:apply-templates/>
113  </fo:block>
114</xsl:template>
115
116</xsl:stylesheet>
117