summaryrefslogtreecommitdiff
path: root/optionDocGen.xslt
blob: f31f9a470479f4b7028e3d4e3351702d3a9ff857 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!--

  Compiz option documentation generator (produces html)

  Copyright : (C) 2007 by Erkin Bahceci
  E-mail    : erkinbah@gmail.com

  Print helpers : (C) 2007 by Dennis Kasprzyk
  E-mail        : onestone@beryl-project.org

  
  This program 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.
 
  This program 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.


  
  Example usage:

  xsltproc -o doc.html optionDocGen.xslt /usr/share/compiz/animation.xml
 

-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output  method="html"/>

    <!-- *** main block *** -->

    <xsl:template match="/compiz/core">
      <HTML><BODY>
	  <H1><B><U><xsl:text>Core</xsl:text></U></B></H1>
	  <xsl:apply-templates select="display"/>
	  <xsl:apply-templates select="screen"/>
      </BODY></HTML>
    </xsl:template>

    <xsl:template match="/compiz/plugin">
      <HTML><BODY>
	  <H1><B><U><xsl:text>Plugin: </xsl:text>
	      <xsl:call-template name="Print">
		<xsl:with-param name="text">
		  <xsl:value-of select="/compiz/plugin/@name"/>
		</xsl:with-param>
	      </xsl:call-template>
	  </U></B></H1>
	  <xsl:apply-templates select="display"/>
	  <xsl:apply-templates select="screen"/>
      </BODY></HTML>
    </xsl:template>

    <xsl:template match="display">
      <H2><B><xsl:text>Options for All Screens</xsl:text></B></H2>
      <UL>
	<xsl:for-each select="option">
	  <xsl:sort select="short"/>
	  <xsl:apply-templates select="."/>
	</xsl:for-each>
      </UL>
    </xsl:template>

    <xsl:template match="screen">
      <H2><B><xsl:text>Options for Screen</xsl:text></B></H2>
      <UL>
	<xsl:for-each select="option">
	  <xsl:sort select="short"/>
	  <xsl:apply-templates select="."/>
	</xsl:for-each>
	<xsl:for-each select="group">
	  <xsl:sort select="short"/>
	  <xsl:apply-templates select="."/>
	</xsl:for-each>
      </UL>
    </xsl:template>

    <xsl:template match="group">
      <H3><B><xsl:value-of select="./short"/></B></H3>
      <xsl:if test="short='Effect Settings'">
	<xsl:if test="/compiz/plugin[@name='animation']">
	  <B><font color="red">
	      <xsl:text disable-output-escaping="yes">Only these options can be used in the "options" part in animation selection lists.</xsl:text>
	  </font></B>
	</xsl:if>
      </xsl:if>
      <UL>
	<xsl:for-each select="subgroup">
	  <xsl:sort select="short"/>
	  <xsl:apply-templates select="."/>
	</xsl:for-each>
      </UL>
    </xsl:template>

    <xsl:template match="subgroup">
      <LI>
	<H4><B><xsl:value-of select="./short"/></B></H4>
	<xsl:for-each select="option">
	  <xsl:sort select="short"/>
	  <xsl:apply-templates select="."/>
	</xsl:for-each>
      </LI>
    </xsl:template>

    <xsl:template match="option">
      <xsl:if test="short">
	<P><B><xsl:value-of select="short"/></B>
	  <xsl:text>:</xsl:text>
	  <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;name: </xsl:text></B>
	  <xsl:value-of select="@name"/>
	  <xsl:if test="@type">
	    <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;type: </xsl:text></B>
	    <xsl:value-of select="@type"/>
	  </xsl:if>
	  <xsl:if test="min">
	    <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;min: </xsl:text></B>
	    <xsl:value-of select="min"/>
	  </xsl:if>
	  <xsl:if test="max">
	    <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;max: </xsl:text></B>
	    <xsl:value-of select="max"/>
	  </xsl:if>
	  <BR/>
	  <xsl:value-of select="long"/>
	  <xsl:if test="desc">
	    <table border="1" cellpadding="2" cellspacing="0">
	      <tr bgcolor="#dddddd">
		<th align="center">Value</th>
		<th align="left">Description</th>
	      </tr>
	      <xsl:apply-templates select="desc"/>
	    </table>
	  </xsl:if>
	</P>
      </xsl:if>
    </xsl:template>

    <xsl:template match="desc">
      <TR>
	<TD align="center"><xsl:value-of select="value"/></TD>
	<TD align="left"><xsl:value-of select="name"/></TD>
      </TR>
    </xsl:template>
    
    <!-- String conversion helper functions -->

    <xsl:template name="print">
        <xsl:param name="text"/>
	<xsl:value-of select="translate($text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
    </xsl:template>

    <xsl:template name="PRINT">
        <xsl:param name="text"/>
	<xsl:value-of select="translate($text,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
    </xsl:template>

    <xsl:template name="Print">
        <xsl:param name="text"/>
	<xsl:call-template name="PRINT">
	    <xsl:with-param name="text">
		<xsl:value-of select="substring($text,1,1)"/>
	    </xsl:with-param>
	</xsl:call-template>
	<xsl:call-template name="print">
	    <xsl:with-param name="text">
		<xsl:value-of select="substring($text,2)"/>
	    </xsl:with-param>
	</xsl:call-template>
    </xsl:template>
    
</xsl:stylesheet>