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