comparison flys-artifacts/contrib/themes2html.xsl @ 3468:f37e7e8907cb

merged flys-artifacts/2.8.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:39 +0200
parents ee37ccea3b09
children
comparison
equal deleted inserted replaced
3387:5ffad8bde8ad 3468:f37e7e8907cb
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet
3 version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6 <xsl:output method="xml" encoding="UTF-8"
7 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
8 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes"/>
9
10
11 <xsl:template match="/themes/themegroup" mode="header">
12 <li><a href="#tg-{@name}"><xsl:value-of select="@name"/></a> (<xsl:value-of select="count(theme)"/> themes)</li>
13 </xsl:template>
14
15 <xsl:template match="field" mode="theme-inherits">
16 <tr>
17 <td><i><xsl:value-of select="@name"/></i> (<a
18 href="#theme-{../../../@name}-{../../@name}"><xsl:value-of select="../../@name"/></a>)</td>
19 <td><xsl:value-of select="@display"/></td>
20 <td><xsl:value-of select="@type"/></td>
21 <td><xsl:value-of select="@default"/></td>
22 <td><xsl:value-of select="@hints"/></td>
23 </tr>
24 </xsl:template>
25
26 <xsl:template match="field" mode="theme-fields">
27 <tr>
28 <td><xsl:value-of select="@name"/></td>
29 <td><xsl:value-of select="@display"/></td>
30 <td><xsl:value-of select="@type"/></td>
31 <td><xsl:value-of select="@default"/></td>
32 <td><xsl:value-of select="@hints"/></td>
33 </tr>
34 </xsl:template>
35
36 <xsl:template match="inherit" mode="theme-inherits">
37 <xsl:variable name="target" select="@from"/>
38 <xsl:apply-templates
39 select="../../../theme[@name = $target]/inherits/inherit | /themes/themegroup/theme[@type='virtual' and @name=$target]/inherits/inherit"
40 mode="theme-inherits"/>
41 <xsl:apply-templates
42 select="../../../theme[@name = $target]/fields/field | /themes/themegroup/theme[@type='virtual' and @name=$target]/fields/field"
43 mode="theme-inherits"/>
44 </xsl:template>
45
46 <xsl:template match="theme" mode="sub-themes">
47 <xsl:variable name="tname" select="../@name"/>
48 <xsl:variable name="name" select="@name"/>
49 <li><a href="#theme-{$tname}-{$name}"><xsl:value-of select="$tname"/>/<xsl:value-of select="$name"/></a></li>
50 </xsl:template>
51
52 <xsl:template match="theme" mode="theme-groups">
53 <div>
54 <h4>[<a href="#theme-groups">Groups</a>] [<a href="#tg-{../@name}"><xsl:value-of select="../@name"/></a>] <a
55 name="theme-{../@name}-{@name}">Theme '<xsl:value-of select="@name"/>'<xsl:if
56 test="@type = 'virtual'"> (virtual)</xsl:if></a></h4>
57
58 <xsl:variable name="tname" select="../@name"/>
59 <xsl:variable name="is-virtual" select="$tname = 'virtual'"/>
60 <xsl:variable name="name" select="@name"/>
61
62 <xsl:if
63 test="count(/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]) &gt; 0">
64 <strong>Sub themes</strong>
65 <ul>
66 <xsl:apply-templates
67 select="/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]"
68 mode="sub-themes"/>
69 </ul>
70 </xsl:if>
71
72 <table border="1" cellspacing="0" width="80%" summary="Definition of theme {@name}">
73 <tr>
74 <th>Name</th>
75 <th>Display</th>
76 <th>Type</th>
77 <th>Default</th>
78 <th>Hints</th>
79 </tr>
80 <xsl:apply-templates mode="theme-inherits" select="inherits/inherit"/>
81 <xsl:apply-templates mode="theme-fields" select="fields/field"/>
82 </table>
83 </div>
84 <hr/>
85 </xsl:template>
86
87 <xsl:template match="theme" mode="theme-list">
88 <li><a href="#theme-{../@name}-{@name}"><xsl:value-of select="@name"/></a></li>
89 </xsl:template>
90
91 <xsl:template match="/themes/themegroup" mode="theme-groups">
92 <div>
93 <h2><a name="tg-{@name}">Theme group '<xsl:value-of select="@name"/>'</a></h2>
94 <div>
95 <h3>Theme List</h3>
96 <ul>
97 <xsl:apply-templates mode="theme-list" select="theme"/>
98 </ul>
99 </div>
100 <div>
101 <h3>Theme Definitions</h3>
102 <xsl:apply-templates mode="theme-groups" select="theme"/>
103 </div>
104 </div>
105 </xsl:template>
106
107 <xsl:template match="mapping" mode="mappings">
108 <xsl:variable name="target" select="@to"/>
109 <tr>
110 <td><xsl:value-of select="@from"/></td>
111 <td><a
112 href="#theme-{/themes/themegroup/theme[@name = $target][1]/../@name}-{$target}"
113 ><xsl:value-of select="@to"/></a></td>
114 <td><xsl:if test="@pattern"><pre><xsl:value-of select="@pattern"/></pre></xsl:if></td>
115 <td><xsl:if test="@masterAttr"><pre><xsl:value-of select="@masterAttr"/></pre></xsl:if></td>
116 </tr>
117 </xsl:template>
118
119 <xsl:template match="mappings" mode="mappings">
120 <div>
121 <h3><a name="mappings">Mappings</a></h3>
122 <table width="80%" border="1" cellspacing="0" summary="Mappings from facets to themes">
123 <tr>
124 <th>From</th>
125 <th>To</th>
126 <th>Pattern</th>
127 <th>Condition</th>
128 </tr>
129 <xsl:apply-templates select="mapping" mode="mappings"/>
130 </table>
131 </div>
132 </xsl:template>
133
134 <xsl:template match="/">
135 <html>
136 <head>
137 <title>FLYS3 - Themes</title>
138 </head>
139 <body>
140 <h1>FLYS3 - Themes</h1>
141 <div>
142 <h2><a name="theme-groups">Theme groups</a> (<xsl:value-of select="count(/themes/themegroup)"/> groups)</h2>
143 <ul>
144 <xsl:apply-templates mode="header" select="/themes/themegroup[@name != 'virtual']"/>
145 <xsl:apply-templates mode="header" select="/themes/themegroup[@name = 'virtual']"/>
146 </ul>
147 </div>
148 <div>
149 <h2><a href="#mappings">Mappings</a> (<xsl:value-of select="count(/themes/mappings/mapping)"/> mappings)</h2>
150 </div>
151 <hr/>
152 <div>
153 <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name != 'virtual']"/>
154 <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name = 'virtual']"/>
155 </div>
156 <xsl:apply-templates mode="mappings" select="/themes/mappings"/>
157 </body>
158 </html>
159 </xsl:template>
160
161 <xsl:template match="text()"/>
162 <xsl:template match="text()" mode="header"/>
163 <xsl:template match="text()" mode="theme-groups"/>
164 <xsl:template match="text()" mode="theme-list"/>
165 <xsl:template match="text()" mode="sub-themes"/>
166 <xsl:template match="text()" mode="theme-fields"/>
167 <xsl:template match="text()" mode="theme-inherits"/>
168 <xsl:template match="text()" mode="mappings"/>
169
170 </xsl:stylesheet>

http://dive4elements.wald.intevation.org