Debian Codegraph @

docbook-xsl-ns/xhtml/admon.xsl

raw
1 <?xml version="1.0" encoding="ASCII"?><!--This file was created automatically by html2xhtml--><!--from the HTML stylesheets.--><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="d" version="1.0">
2
3 <!-- ********************************************************************
4
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
8
9 ******************************************************************** -->
10
11 <xsl:template match="*" mode="admon.graphic.width">
12 <xsl:param name="node" select="."/>
13 <xsl:text>25</xsl:text>
14 </xsl:template>
15
16 <xsl:template match="d:note|d:important|d:warning|d:caution|d: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">
28 <xsl:param name="node" select="."/>
29 <xsl:value-of select="$admon.graphics.path"/>
30 <xsl:choose>
31 <xsl:when test="local-name($node)='note'">note</xsl:when>
32 <xsl:when test="local-name($node)='warning'">warning</xsl:when>
33 <xsl:when test="local-name($node)='caution'">caution</xsl:when>
34 <xsl:when test="local-name($node)='tip'">tip</xsl:when>
35 <xsl:when test="local-name($node)='important'">important</xsl:when>
36 <xsl:otherwise>note</xsl:otherwise>
37 </xsl:choose>
38 <xsl:value-of select="$admon.graphics.extension"/>
39 </xsl:template>
40
41 <xsl:template name="graphical.admonition">
42 <xsl:variable name="admon.type">
43 <xsl:choose>
44 <xsl:when test="local-name(.)='note'">Note</xsl:when>
45 <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
46 <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
47 <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
48 <xsl:when test="local-name(.)='important'">Important</xsl:when>
49 <xsl:otherwise>Note</xsl:otherwise>
50 </xsl:choose>
51 </xsl:variable>
52
53 <xsl:variable name="alt">
54 <xsl:call-template name="gentext">
55 <xsl:with-param name="key" select="$admon.type"/>
56 </xsl:call-template>
57 </xsl:variable>
58
59 <div>
60 <xsl:call-template name="common.html.attributes"/>
61 <xsl:call-template name="id.attribute"/>
62 <xsl:if test="$admon.style != '' and $make.clean.html = 0">
63 <xsl:attribute name="style">
64 <xsl:value-of select="$admon.style"/>
65 </xsl:attribute>
66 </xsl:if>
67
68 <table border="{$table.border.off}">
69 <!-- omit summary attribute in html5 output -->
70 <xsl:if test="$div.element != 'section'">
71 <xsl:attribute name="summary">
72 <xsl:value-of select="$admon.type"/>
73 <xsl:if test="d:title|d:info/d:title">
74 <xsl:text>: </xsl:text>
75 <xsl:value-of select="(d:title|d:info/d:title)[1]"/>
76 </xsl:if>
77 </xsl:attribute>
78 </xsl:if>
79 <tr>
80 <td rowspan="2" align="center" valign="top">
81 <xsl:attribute name="width">
82 <xsl:apply-templates select="." mode="admon.graphic.width"/>
83 </xsl:attribute>
84 <img alt="[{$alt}]">
85 <xsl:attribute name="src">
86 <xsl:call-template name="admon.graphic"/>
87 </xsl:attribute>
88 </img>
89 </td>
90 <th align="{$direction.align.start}">
91 <xsl:call-template name="anchor"/>
92 <xsl:if test="$admon.textlabel != 0 or d:title or d:info/d:title">
93 <xsl:apply-templates select="." mode="object.title.markup"/>
94 </xsl:if>
95 </th>
96 </tr>
97 <tr>
98 <td align="{$direction.align.start}" valign="top">
99 <xsl:apply-templates/>
100 </td>
101 </tr>
102 </table>
103 </div>
104 </xsl:template>
105
106 <xsl:template name="nongraphical.admonition">
107 <div>
108 <xsl:call-template name="common.html.attributes">
109 <xsl:with-param name="inherit" select="1"/>
110 </xsl:call-template>
111 <xsl:call-template name="id.attribute"/>
112 <xsl:if test="$admon.style != '' and $make.clean.html = 0">
113 <xsl:attribute name="style">
114 <xsl:value-of select="$admon.style"/>
115 </xsl:attribute>
116 </xsl:if>
117
118 <xsl:if test="$admon.textlabel != 0 or d:title or d:info/d:title">
119 <h3 class="title">
120 <xsl:call-template name="anchor"/>
121 <xsl:apply-templates select="." mode="object.title.markup"/>
122 </h3>
123 </xsl:if>
124
125 <xsl:apply-templates/>
126 </div>
127 </xsl:template>
128
129 <xsl:template match="d:note/d:title"/>
130 <xsl:template match="d:important/d:title"/>
131 <xsl:template match="d:warning/d:title"/>
132 <xsl:template match="d:caution/d:title"/>
133 <xsl:template match="d:tip/d:title"/>
134
135 </xsl:stylesheet>