]> git.meshlink.io Git - catta/blob - man/xmltoman.xsl
1a344c2ac2b59468480a0d864395a2413039fcda
[catta] / man / xmltoman.xsl
1 <?xml version="1.0" encoding="iso-8859-15"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
3
4 <!-- 
5   This file is part of avahi.
6
7   avahi is free software; you can redistribute it and/or modify it under
8   the terms of the GNU General Public License as published by the Free
9   Software Foundation; either version 2 of the License, or (at your
10   option) any later version.
11
12   avahi is distributed in the hope that it will be useful, but WITHOUT
13   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15   for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with avahi; if not, write to the Free Software Foundation,
19   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 
20 -->
21
22 <xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
23
24 <xsl:template match="/manpage">
25   
26     <html>
27
28     <head>
29       <title><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</title>
30       <style type="text/css">
31         body { color: black; background-color: white; } 
32         a:link, a:visited { color: #900000; }       
33         h1 { text-transform:uppercase; font-size: 18pt; } 
34         p { margin-left:1cm; margin-right:1cm; } 
35         .cmd { font-family:monospace; }
36         .file { font-family:monospace; }
37         .arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
38         .opt { font-family:monospace; font-weight: bold;  }
39         .manref { font-family:monospace; }
40         .option .optdesc { margin-left:2cm; }
41       </style>
42     </head>
43     <body>
44       <h1>Name</h1>
45       <p><xsl:value-of select="@name"/>
46         <xsl:if test="string-length(@desc) &gt; 0"> - <xsl:value-of select="@desc"/></xsl:if>
47       </p>
48       <xsl:apply-templates />
49     </body>
50   </html>
51 </xsl:template>
52
53 <xsl:template match="p">
54  <p>
55   <xsl:apply-templates/>
56  </p>
57 </xsl:template>
58
59 <xsl:template match="cmd">
60  <p class="cmd">
61   <xsl:apply-templates/>
62  </p>
63 </xsl:template>
64
65 <xsl:template match="arg">
66   <span class="arg"><xsl:apply-templates/></span>
67 </xsl:template>
68
69 <xsl:template match="opt">
70   <span class="opt"><xsl:apply-templates/></span>
71 </xsl:template>
72
73 <xsl:template match="file">
74   <span class="file"><xsl:apply-templates/></span>
75 </xsl:template>
76
77 <xsl:template match="optdesc">
78   <div class="optdesc">
79     <xsl:apply-templates/>
80   </div>
81 </xsl:template>
82
83 <xsl:template match="synopsis">
84   <h1>Synopsis</h1>
85   <xsl:apply-templates/>
86 </xsl:template>
87
88 <xsl:template match="seealso">
89   <h1>Synopsis</h1>
90   <xsl:apply-templates/>
91 </xsl:template>
92
93 <xsl:template match="description">
94   <h1>Description</h1>
95   <xsl:apply-templates/>
96 </xsl:template>
97
98 <xsl:template match="options">
99   <h1>Options</h1>
100   <xsl:apply-templates/>
101 </xsl:template>
102
103 <xsl:template match="section">
104   <h1><xsl:value-of select="@name"/></h1>
105   <xsl:apply-templates/>
106 </xsl:template>
107
108 <xsl:template match="option">
109   <div class="option"><xsl:apply-templates/></div>
110 </xsl:template>
111
112 <xsl:template match="manref">
113   <xsl:choose>
114     <xsl:when test="string-length(@href) &gt; 0">
115     <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a>
116     </xsl:when>
117     <xsl:otherwise>
118     <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
119     </xsl:otherwise>
120   </xsl:choose>
121 </xsl:template>
122
123 <xsl:template match="url">
124   <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
125 </xsl:template>
126
127 </xsl:stylesheet>