Mercurial > dive4elements > river
comparison flys-artifacts/contrib/themes2html.xsl @ 3262:e01f74c3ec1e
Themes: Added XSL transformation to generate a better overview of the themes.
flys-artifacts/trunk@4901 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 08 Jul 2012 14:55:03 +0000 |
parents | |
children | ee37ccea3b09 |
comparison
equal
deleted
inserted
replaced
3261:8f9d49467c85 | 3262:e01f74c3ec1e |
---|---|
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="theme-groups"> | |
47 <div> | |
48 <h4>[<a href="#theme-groups">Groups</a>] [<a href="#tg-{../@name}"><xsl:value-of select="../@name"/></a>] <a | |
49 name="theme-{../@name}-{@name}">Theme '<xsl:value-of select="@name"/>'<xsl:if | |
50 test="@type = 'virtual'"> (virtual)</xsl:if></a></h4> | |
51 <table border="1" cellspacing="0" width="80%" summary="Definition of theme {@name}"> | |
52 <tr> | |
53 <th>Name</th> | |
54 <th>Display</th> | |
55 <th>Type</th> | |
56 <th>Default</th> | |
57 <th>Hints</th> | |
58 </tr> | |
59 <xsl:apply-templates mode="theme-inherits" select="inherits/inherit"/> | |
60 <xsl:apply-templates mode="theme-fields" select="fields/field"/> | |
61 </table> | |
62 </div> | |
63 <hr/> | |
64 </xsl:template> | |
65 | |
66 <xsl:template match="theme" mode="theme-list"> | |
67 <li><a href="#theme-{../@name}-{@name}"><xsl:value-of select="@name"/></a></li> | |
68 </xsl:template> | |
69 | |
70 <xsl:template match="/themes/themegroup" mode="theme-groups"> | |
71 <div> | |
72 <h2><a name="tg-{@name}">Theme group '<xsl:value-of select="@name"/>'</a></h2> | |
73 <div> | |
74 <h3>Theme List</h3> | |
75 <ul> | |
76 <xsl:apply-templates mode="theme-list" select="theme"/> | |
77 </ul> | |
78 </div> | |
79 <div> | |
80 <h3>Theme Definitions</h3> | |
81 <xsl:apply-templates mode="theme-groups" select="theme"/> | |
82 </div> | |
83 </div> | |
84 </xsl:template> | |
85 | |
86 <xsl:template match="mapping" mode="mappings"> | |
87 <xsl:variable name="target" select="@to"/> | |
88 <tr> | |
89 <td><xsl:value-of select="@from"/></td> | |
90 <td><a | |
91 href="#theme-{/themes/themegroup/theme[@name = $target][1]/../@name}-{$target}" | |
92 ><xsl:value-of select="@to"/></a></td> | |
93 <td><xsl:if test="@pattern"><pre><xsl:value-of select="@pattern"/></pre></xsl:if></td> | |
94 <td><xsl:if test="@masterAttr"><pre><xsl:value-of select="@masterAttr"/></pre></xsl:if></td> | |
95 </tr> | |
96 </xsl:template> | |
97 | |
98 <xsl:template match="mappings" mode="mappings"> | |
99 <div> | |
100 <h3><a name="mappings">Mappings</a></h3> | |
101 <table width="80%" border="1" cellspacing="0" summary="Mappings from facets to themes"> | |
102 <tr> | |
103 <th>From</th> | |
104 <th>To</th> | |
105 <th>Pattern</th> | |
106 <th>Condition</th> | |
107 </tr> | |
108 <xsl:apply-templates select="mapping" mode="mappings"/> | |
109 </table> | |
110 </div> | |
111 </xsl:template> | |
112 | |
113 <xsl:template match="/"> | |
114 <html> | |
115 <head> | |
116 <title>FLYS3 - Themes</title> | |
117 </head> | |
118 <body> | |
119 <h1>FLYS3 - Themes</h1> | |
120 <div> | |
121 <h2><a name="theme-groups">Theme groups</a> (<xsl:value-of select="count(/themes/themegroup)"/> groups)</h2> | |
122 <ul> | |
123 <xsl:apply-templates mode="header" select="/themes/themegroup[@name != 'virtual']"/> | |
124 <xsl:apply-templates mode="header" select="/themes/themegroup[@name = 'virtual']"/> | |
125 </ul> | |
126 </div> | |
127 <div> | |
128 <h2><a href="#mappings">Mappings</a> (<xsl:value-of select="count(/themes/mappings/mapping)"/> mappings)</h2> | |
129 </div> | |
130 <hr/> | |
131 <div> | |
132 <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name != 'virtual']"/> | |
133 <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name = 'virtual']"/> | |
134 </div> | |
135 <xsl:apply-templates mode="mappings" select="/themes/mappings"/> | |
136 </body> | |
137 </html> | |
138 </xsl:template> | |
139 | |
140 <xsl:template match="text()"/> | |
141 <xsl:template match="text()" mode="header"/> | |
142 <xsl:template match="text()" mode="theme-groups"/> | |
143 <xsl:template match="text()" mode="theme-list"/> | |
144 <xsl:template match="text()" mode="theme-fields"/> | |
145 <xsl:template match="text()" mode="theme-inherits"/> | |
146 <xsl:template match="text()" mode="mappings"/> | |
147 | |
148 </xsl:stylesheet> |