root/gaphor-doc/trunk/xsl/gaphor.xsl

Revision 710, 7.6 kB (checked in by wrobell, 3 years ago)

- use docbook 4.2
- added chapter about using gaphor diagrams in project documentation

with subsection about TeX/LaTeX

- use xinclude instead of system entities for chapter inclusion
- use gaphorconvert to convert files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?xml version='1.0'?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 version="1.0"
4                 xmlns="http://www.w3.org/TR/xhtml1/transitional"
5                 exclude-result-prefixes="#default">
6
7   <!-- import the chunked XSL stylesheet -->
8   <!-- xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/-->
9   <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
10   <!-- xsl:include href="devhelp.xsl"/ -->
11
12   <!-- change some parameters -->
13   <xsl:param name="toc.section.depth">2</xsl:param>
14
15   <xsl:param name="default.encoding" select="'ISO-8859-1'"/>
16   <xsl:param name="chapter.autolabel" select="1"/>
17   <xsl:param name="section.autolabel" select="1"/>
18   <xsl:param name="section.label.includes.component.label" select="1"/>
19
20   <xsl:param name="use.id.as.filename" select="'1'"/>
21   <xsl:param name="html.ext" select="'.html'"/>
22   <xsl:param name="refentry.generate.name" select="0"/>
23   <xsl:param name="refentry.generate.title" select="1"/>
24
25   <!-- display variablelists as tables -->
26   <xsl:param name="variablelist.as.table" select="0"/>
27
28   <!-- this gets set on the command line ... -->
29   <xsl:param name="gtkdoc.bookname" select="''"/>
30
31   <!-- ========================================================= -->
32   <!-- template to create the index.sgml anchor index -->
33
34   <xsl:template match="book|article">
35     <xsl:apply-imports/>
36
37     <!-- generate the index.sgml href index -->
38     <xsl:call-template name="generate.index"/>
39     <!-- xsl:call-template name="generate.devhelp"/ -->
40   </xsl:template>
41
42   <xsl:template name="generate.index">
43     <xsl:call-template name="write.text.chunk">
44       <xsl:with-param name="filename" select="'index.sgml'"/>
45       <xsl:with-param name="content">
46         <!-- check all anchor and refentry elements -->
47         <xsl:apply-templates select="//anchor|refentry"
48                              mode="generate.index.mode"/>
49       </xsl:with-param>
50       <xsl:with-param name="encoding" select="'utf-8'"/>
51     </xsl:call-template>
52   </xsl:template>
53
54   <xsl:template match="*" mode="generate.index.mode">
55     <xsl:if test="not(@href)">
56       <xsl:text>&lt;ANCHOR id=&quot;</xsl:text>
57       <xsl:value-of select="@id"/>
58       <xsl:text>&quot; href=&quot;</xsl:text>
59       <xsl:if test="$gtkdoc.bookname">
60         <xsl:value-of select="$gtkdoc.bookname"/>
61         <xsl:text>/</xsl:text>
62       </xsl:if>
63       <xsl:call-template name="href.target"/>
64       <xsl:text>&quot;&gt;
65 </xsl:text>
66     </xsl:if>
67   </xsl:template>
68
69   <!-- ========================================================= -->
70   <!-- template to output gtkdoclink elements for the unknown targets -->
71
72   <xsl:template match="link">
73     <xsl:choose>
74       <xsl:when test="id(@linkend)">
75         <xsl:apply-imports/>
76       </xsl:when>
77       <xsl:otherwise>
78         <GTKDOCLINK HREF="{@linkend}">
79           <xsl:apply-templates/>
80         </GTKDOCLINK>
81       </xsl:otherwise>
82     </xsl:choose>
83   </xsl:template>
84
85   <!-- ========================================================= -->
86   <!-- Below are the visual portions of the stylesheet.  They provide
87        the normal gtk-doc output style. -->
88
89   <xsl:param name="shade.verbatim" select="0"/>
90   <xsl:param name="refentry.separator" select="0"/>
91
92   <xsl:template match="refsect2">
93     <xsl:if test="preceding-sibling::refsect2">
94       <hr/>
95     </xsl:if>
96     <xsl:apply-imports/>
97   </xsl:template>
98
99   <xsl:template name="user.head.content">
100     <style type="text/css" media="all" title="Default">
101       <xsl:text>@import url(all.css);</xsl:text>
102     </style>
103     <style type="text/css" media="print">
104       <xsl:text>@import url(print.css);</xsl:text>
105     </style>
106   </xsl:template>
107
108   <xsl:template name="navigation.menu">
109     <xsl:param name="prev" select="."/>
110     <xsl:param name="next" select="."/>
111     <xsl:variable name="home" select="/*[1]"/>
112     <xsl:variable name="up" select="parent::*"/>
113
114     <ul xmlns="http://www.w3.org/1999/xhtml">
115       <xsl:if test="count($prev)&gt;0">
116         <li>
117           <a accesskey="p">
118             <xsl:attribute name="href">
119               <xsl:call-template name="href.target">
120                 <xsl:with-param name="object" select="$prev"/>
121               </xsl:call-template>
122             </xsl:attribute>
123             <xsl:call-template name="navig.content">
124                 <xsl:with-param name="direction" select="'prev'"/>
125             </xsl:call-template>
126             <xsl:text> (</xsl:text>
127               <xsl:apply-templates select="$prev" mode="object.title.markup"/>
128             <xsl:text>)</xsl:text>
129           </a>
130         </li>
131       </xsl:if>
132       <xsl:if test="count($up)&gt;0">
133         <li>
134           <a accesskey="u">
135             <xsl:attribute name="href">
136               <xsl:call-template name="href.target">
137                 <xsl:with-param name="object" select="$up"/>
138               </xsl:call-template>
139             </xsl:attribute>
140             <xsl:call-template name="navig.content">
141                 <xsl:with-param name="direction" select="'up'"/>
142             </xsl:call-template>
143           </a>
144         </li>
145       </xsl:if>
146       <xsl:if test="$home != .">
147         <li>
148           <a accesskey="h">
149             <xsl:attribute name="href">
150               <xsl:call-template name="href.target">
151                 <xsl:with-param name="object" select="$home"/>
152               </xsl:call-template>
153             </xsl:attribute>
154             <xsl:call-template name="navig.content">
155               <xsl:with-param name="direction" select="'home'"/>
156             </xsl:call-template>
157           </a>
158         </li>
159       </xsl:if>
160       <xsl:if test="count($next)&gt;0">
161         <li>
162           <a accesskey="n">
163             <xsl:attribute name="href">
164               <xsl:call-template name="href.target">
165                 <xsl:with-param name="object" select="$next"/>
166               </xsl:call-template>
167             </xsl:attribute>
168             <xsl:call-template name="navig.content">
169                 <xsl:with-param name="direction" select="'next'"/>
170             </xsl:call-template>
171             <xsl:text> (</xsl:text>
172               <xsl:apply-templates select="$next" mode="object.title.markup"/>
173             <xsl:text>)</xsl:text>
174           </a>
175         </li>
176       </xsl:if>
177     </ul>
178   </xsl:template>
179
180   <xsl:template name="header.navigation">
181     <xsl:param name="prev" select="/foo"/>
182     <xsl:param name="next" select="/foo"/>
183
184     <xsl:if test="$suppress.navigation = '0'">
185       <div xmlns="http://www.w3.org/1999/xhtml" id="navheader">
186         <h1><span id="titletext">Gaphor</span></h1>
187         <xsl:call-template name="navigation.menu">
188           <xsl:with-param name="prev" select="$prev"/>
189           <xsl:with-param name="next" select="$next"/>
190         </xsl:call-template>
191       </div>
192     </xsl:if>
193   </xsl:template>
194
195   <xsl:template name="footer.navigation">
196     <xsl:param name="prev" select="/foo"/>
197     <xsl:param name="next" select="/foo"/>
198     <xsl:variable name="home" select="/*[1]"/>
199     <xsl:variable name="up" select="parent::*"/>
200
201     <xsl:if test="$suppress.navigation = '0'">
202       <div xmlns="http://www.w3.org/1999/xhtml" id="navfooter">
203         <xsl:call-template name="navigation.menu">
204           <xsl:with-param name="prev" select="$prev"/>
205           <xsl:with-param name="next" select="$next"/>
206         </xsl:call-template>
207         <!--
208         <table width="100%" summary="Navigation footer">
209           <tr>
210             <td width="50%" align="left" valign="top">
211               <xsl:if test="$navig.showtitles != 0">
212                 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
213               </xsl:if>
214               <xsl:text>&#160;</xsl:text>
215             </td>
216             <td width="50%" align="right" valign="top">
217               <xsl:text>&#160;</xsl:text>
218               <xsl:if test="$navig.showtitles != 0">
219                 <xsl:apply-templates select="$next" mode="object.title.markup"/>
220               </xsl:if>
221             </td>
222           </tr>
223         </table>
224         -->
225       </div>
226     </xsl:if>
227   </xsl:template>
228
229
230 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.