]> git.meshlink.io Git - catta/blob - man/xmltoman.xsl
96c9d81e93cffa93e287a4723d86d9b0c22e34d7
[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 <!-- $Id$ -->
23
24 <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"/>
25
26 <xsl:template match="/manpage">
27   
28     <html>
29
30     <head>
31       <title><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</title>
32       <style type="text/css">
33         body { color: black; background-color: white; } 
34         a:link, a:visited { color: #900000; }       
35         h1 { text-transform:uppercase; font-size: 18pt; } 
36         p { margin-left:1cm; margin-right:1cm; } 
37         .cmd { font-family:monospace; }
38         .file { font-family:monospace; }
39         .arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
40         .opt { font-family:monospace; font-weight: bold;  }
41         .manref { font-family:monospace; }
42         .option .optdesc { margin-left:2cm; }
43       </style>
44     </head>
45     <body>
46       <h1>Name</h1>
47       <p><xsl:value-of select="@name"/>
48         <xsl:if test="string-length(@desc) &gt; 0"> - <xsl:value-of select="@desc"/></xsl:if>
49       </p>
50       <xsl:apply-templates />
51     </body>
52   </html>
53 </xsl:template>
54
55 <xsl:template match="p">
56  <p>
57   <xsl:apply-templates/>
58  </p>
59 </xsl:template>
60
61 <xsl:template match="cmd">
62  <p class="cmd">
63   <xsl:apply-templates/>
64  </p>
65 </xsl:template>
66
67 <xsl:template match="arg">
68   <span class="arg"><xsl:apply-templates/></span>
69 </xsl:template>
70
71 <xsl:template match="opt">
72   <span class="opt"><xsl:apply-templates/></span>
73 </xsl:template>
74
75 <xsl:template match="file">
76   <span class="file"><xsl:apply-templates/></span>
77 </xsl:template>
78
79 <xsl:template match="optdesc">
80   <div class="optdesc">
81     <xsl:apply-templates/>
82   </div>
83 </xsl:template>
84
85 <xsl:template match="synopsis">
86   <h1>Synopsis</h1>
87   <xsl:apply-templates/>
88 </xsl:template>
89
90 <xsl:template match="seealso">
91   <h1>Synopsis</h1>
92   <xsl:apply-templates/>
93 </xsl:template>
94
95 <xsl:template match="description">
96   <h1>Description</h1>
97   <xsl:apply-templates/>
98 </xsl:template>
99
100 <xsl:template match="options">
101   <h1>Options</h1>
102   <xsl:apply-templates/>
103 </xsl:template>
104
105 <xsl:template match="section">
106   <h1><xsl:value-of select="@name"/></h1>
107   <xsl:apply-templates/>
108 </xsl:template>
109
110 <xsl:template match="option">
111   <div class="option"><xsl:apply-templates/></div>
112 </xsl:template>
113
114 <xsl:template match="manref">
115   <xsl:choose>
116     <xsl:when test="string-length(@href) &gt; 0">
117     <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>
118     </xsl:when>
119     <xsl:otherwise>
120     <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
121     </xsl:otherwise>
122   </xsl:choose>
123 </xsl:template>
124
125 <xsl:template match="url">
126   <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
127 </xsl:template>
128
129 </xsl:stylesheet>