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: admon.xsl,v 1.11 2004/12/08 20:43:51 bobstayton Exp $
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 match="*" mode="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="local-name($node)='note'">note</xsl:when>
36    <xsl:when test="local-name($node)='warning'">warning</xsl:when>
37    <xsl:when test="local-name($node)='caution'">caution</xsl:when>
38    <xsl:when test="local-name($node)='tip'">tip</xsl:when>
39    <xsl:when test="local-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  <xsl:variable name="admon.type">
47    <xsl:choose>
48      <xsl:when test="local-name(.)='note'">Note</xsl:when>
49      <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
50      <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
51      <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
52      <xsl:when test="local-name(.)='important'">Important</xsl:when>
53      <xsl:otherwise>Note</xsl:otherwise>
54    </xsl:choose>
55  </xsl:variable>
56
57  <xsl:variable name="alt">
58    <xsl:call-template name="gentext">
59      <xsl:with-param name="key" select="$admon.type"/>
60    </xsl:call-template>
61  </xsl:variable>
62
63  <div class="{name(.)}">
64    <xsl:if test="$admon.style != ''">
65      <xsl:attribute name="style">
66        <xsl:value-of select="$admon.style"/>
67      </xsl:attribute>
68    </xsl:if>
69
70    <table border="0">
71      <xsl:attribute name="summary">
72        <xsl:value-of select="$admon.type"/>
73        <xsl:if test="title">
74          <xsl:text>: </xsl:text>
75          <xsl:value-of select="title"/>
76        </xsl:if>
77      </xsl:attribute>
78      <tr>
79        <td rowspan="2" align="center" valign="top">
80          <xsl:attribute name="width">
81            <xsl:apply-templates select="." mode="admon.graphic.width"/>
82          </xsl:attribute>
83          <img alt="[{$alt}]">
84            <xsl:attribute name="src">
85              <xsl:call-template name="admon.graphic"/>
86            </xsl:attribute>
87          </img>
88        </td>
89        <th align="left">
90          <xsl:call-template name="anchor"/>
91          <xsl:if test="$admon.textlabel != 0 or title">
92            <xsl:apply-templates select="." mode="object.title.markup"/>
93          </xsl:if>
94        </th>
95      </tr>
96      <tr>
97        <td align="left" valign="top">
98          <xsl:apply-templates/>
99        </td>
100      </tr>
101    </table>
102  </div>
103</xsl:template>
104
105<xsl:template name="nongraphical.admonition">
106  <div class="{name(.)}">
107    <xsl:if test="$admon.style">
108      <xsl:attribute name="style">
109        <xsl:value-of select="$admon.style"/>
110      </xsl:attribute>
111    </xsl:if>
112
113    <h3 class="title">
114      <xsl:call-template name="anchor"/>
115      <xsl:if test="$admon.textlabel != 0 or title">
116        <xsl:apply-templates select="." mode="object.title.markup"/>
117      </xsl:if>
118    </h3>
119
120    <xsl:apply-templates/>
121  </div>
122</xsl:template>
123
124<xsl:template match="note/title"></xsl:template>
125<xsl:template match="important/title"></xsl:template>
126<xsl:template match="warning/title"></xsl:template>
127<xsl:template match="caution/title"></xsl:template>
128<xsl:template match="tip/title"></xsl:template>
129
130</xsl:stylesheet>
131