File: xmltoman.xsl

package info (click to toggle)
xmltoman 0.6-1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 164 kB
  • sloc: xml: 331; perl: 278; makefile: 34
file content (120 lines) | stat: -rw-r--r-- 3,364 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">

<!-- 
  This file is part of xmltoman.

  xmltoman is free software; you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free
  Software Foundation; either version 2 of the License, or (at your
  option) any later version.

  xmltoman is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  for more details.

  You should have received a copy of the GNU General Public License
  along with xmltoman; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 
-->

<xsl:template match="/manpage">
    <xsl:text disable-output-escaping="yes">
    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
    </xsl:text>
    <html>

    <head>
      <title>
        <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>) 
      </title>
      <link rel="stylesheet" type="text/css" href="xmltoman.css"/>
    </head>
    <body>
      <h1>Name</h1>
      <p><xsl:value-of select="@name"/>
        <xsl:if test="string-length(@desc) &gt; 0">
          - <xsl:value-of select="@desc"/>
        </xsl:if>
      </p>
      <xsl:apply-templates />
    </body>
  </html>
</xsl:template>

<xsl:template match="p">
 <p>
  <xsl:apply-templates/>
 </p>
</xsl:template>

<xsl:template match="cmd">
 <p class="cmd">
  <xsl:apply-templates/>
 </p>
</xsl:template>

<xsl:template match="arg">
  <span class="arg"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="opt">
  <span class="opt"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="file">
  <span class="file"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="optdesc">
  <div class="optdesc">
    <xsl:apply-templates/>
  </div>
</xsl:template>

<xsl:template match="synopsis">
  <h1>Synopsis</h1>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="seealso">
  <h1>Synopsis</h1>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="description">
  <h1>Description</h1>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="options">
  <h1>Options</h1>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="section">
  <h1><xsl:value-of select="@name"/></h1>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="option">
  <div class="option"><xsl:apply-templates/></div>
</xsl:template>

<xsl:template match="manref">
  <xsl:choose>
    <xsl:when test="string-length(@href) &gt; 0">
    <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>
    </xsl:when>
    <xsl:otherwise>
    <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="url">
  <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
</xsl:template>

</xsl:stylesheet>