1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version='1.0'>
4
5<!-- ********************************************************************
6     $Id$
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See /README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<xsl:template name="admon.graphic.width">
16  <xsl:param name="node" select="."/>
17  <xsl:text>25</xsl:text>
18</xsl:template>
19
20<xsl:template match="note|important|warning|caution|tip">
21  <xsl:choose>
22    <xsl:when test="$admon.graphics != 0">
23      <xsl:call-template name="graphical.admonition"/>
24    </xsl:when>
25    <xsl:otherwise>
26      <xsl:call-template name="nongraphical.admonition"/>
27    </xsl:otherwise>
28  </xsl:choose>
29</xsl:template>
30
31<xsl:template name="admon.graphic">
32  <xsl:param name="node" select="."/>
33  <xsl:value-of select="$admon.graphics.path"/>
34  <xsl:choose>
35    <xsl:when test="name($node)='note'">note</xsl:when>
36    <xsl:when test="name($node)='warning'">warning</xsl:when>
37    <xsl:when test="name($node)='caution'">caution</xsl:when>
38    <xsl:when test="name($node)='tip'">tip</xsl:when>
39    <xsl:when test="name($node)='important'">important</xsl:when>
40    <xsl:otherwise>note</xsl:otherwise>
41  </xsl:choose>
42  <xsl:value-of select="$admon.graphics.extension"/>
43</xsl:template>
44
45<xsl:template name="graphical.admonition">
46  <div class="{name(.)}">
47  <xsl:if test="$admon.style != ''">
48    <xsl:attribute name="style">
49      <xsl:value-of select="$admon.style"/>
50    </xsl:attribute>
51  </xsl:if>
52  <table border="0">
53    <tr>
54      <td rowspan="2" align="center" valign="top">
55        <xsl:attribute name="width">
56          <xsl:call-template name="admon.graphic.width"/>
57        </xsl:attribute>
58        <img>
59          <xsl:attribute name="src">
60            <xsl:call-template name="admon.graphic"/>
61          </xsl:attribute>
62        </img>
63      </td>
64      <th>
65        <a>
66          <xsl:attribute name="name">
67            <xsl:call-template name="object.id"/>
68          </xsl:attribute>
69        </a>
70        <xsl:apply-templates select="." mode="object.title.markup"/>
71      </th>
72    </tr>
73    <tr>
74      <td colspan="2" align="left" valign="top">
75        <xsl:apply-templates/>
76      </td>
77    </tr>
78  </table>
79  </div>
80</xsl:template>
81
82<xsl:template name="nongraphical.admonition">
83  <div class="{name(.)}">
84    <xsl:if test="$admon.style">
85      <xsl:attribute name="style">
86        <xsl:value-of select="$admon.style"/>
87      </xsl:attribute>
88    </xsl:if>
89
90    <h3 class="title">
91      <a>
92        <xsl:attribute name="name">
93          <xsl:call-template name="object.id"/>
94        </xsl:attribute>
95      </a>
96      <xsl:apply-templates select="." mode="object.title.markup"/>
97    </h3>
98
99    <xsl:apply-templates/>
100  </div>
101</xsl:template>
102
103<xsl:template match="note/title"></xsl:template>
104<xsl:template match="important/title"></xsl:template>
105<xsl:template match="warning/title"></xsl:template>
106<xsl:template match="caution/title"></xsl:template>
107<xsl:template match="tip/title"></xsl:template>
108
109<xsl:template match="title" mode="admonition.title.mode">
110  <xsl:variable name="id">
111    <xsl:call-template name="object.id">
112      <xsl:with-param name="object" select=".."/>
113    </xsl:call-template>
114  </xsl:variable>
115  <h3 class="title">
116    <a name="{$id}">
117      <xsl:apply-templates/>
118    </a>
119  </h3>
120</xsl:template>
121
122<xsl:template match="title" mode="graphic.admonition.title.mode">
123  <xsl:variable name="id">
124    <xsl:call-template name="object.id">
125      <xsl:with-param name="object" select=".."/>
126    </xsl:call-template>
127  </xsl:variable>
128  <b class="title">
129    <a name="{$id}">
130      <xsl:apply-templates/>
131    </a>
132  </b>
133</xsl:template>
134
135</xsl:stylesheet>
136