diff flys-artifacts/contrib/themes2html.xsl @ 3267:ee37ccea3b09

Create a list of direct sub themes of a theme. flys-artifacts/trunk@4907 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 08 Jul 2012 22:31:10 +0000
parents e01f74c3ec1e
children
line wrap: on
line diff
--- a/flys-artifacts/contrib/themes2html.xsl	Sun Jul 08 18:57:59 2012 +0000
+++ b/flys-artifacts/contrib/themes2html.xsl	Sun Jul 08 22:31:10 2012 +0000
@@ -43,11 +43,32 @@
         mode="theme-inherits"/>
   </xsl:template>
 
+  <xsl:template match="theme" mode="sub-themes">
+    <xsl:variable name="tname" select="../@name"/>
+    <xsl:variable name="name" select="@name"/>
+    <li><a href="#theme-{$tname}-{$name}"><xsl:value-of select="$tname"/>/<xsl:value-of select="$name"/></a></li>
+  </xsl:template>
+
   <xsl:template match="theme" mode="theme-groups">
     <div>
-        <h4>[<a href="#theme-groups">Groups</a>] [<a href="#tg-{../@name}"><xsl:value-of select="../@name"/></a>] <a 
-            name="theme-{../@name}-{@name}">Theme '<xsl:value-of select="@name"/>'<xsl:if
-          test="@type = 'virtual'"> (virtual)</xsl:if></a></h4>
+      <h4>[<a href="#theme-groups">Groups</a>] [<a href="#tg-{../@name}"><xsl:value-of select="../@name"/></a>] <a 
+          name="theme-{../@name}-{@name}">Theme '<xsl:value-of select="@name"/>'<xsl:if
+        test="@type = 'virtual'"> (virtual)</xsl:if></a></h4>
+
+      <xsl:variable name="tname" select="../@name"/>
+      <xsl:variable name="is-virtual" select="$tname = 'virtual'"/>
+      <xsl:variable name="name" select="@name"/>
+
+      <xsl:if
+        test="count(/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]) &gt; 0">
+      <strong>Sub themes</strong>
+      <ul>
+        <xsl:apply-templates
+            select="/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]"
+            mode="sub-themes"/>
+      </ul>
+      </xsl:if>
+
       <table border="1" cellspacing="0" width="80%" summary="Definition of theme {@name}">
         <tr>
           <th>Name</th>
@@ -116,23 +137,23 @@
         <title>FLYS3 - Themes</title>
     </head>
     <body>
-        <h1>FLYS3 - Themes</h1>
-        <div>
-        <h2><a name="theme-groups">Theme groups</a> (<xsl:value-of select="count(/themes/themegroup)"/> groups)</h2>
-        <ul>
-          <xsl:apply-templates mode="header" select="/themes/themegroup[@name != 'virtual']"/>
-          <xsl:apply-templates mode="header" select="/themes/themegroup[@name = 'virtual']"/>
-        </ul>
-        </div>
-        <div>
-          <h2><a href="#mappings">Mappings</a> (<xsl:value-of select="count(/themes/mappings/mapping)"/> mappings)</h2>
-        </div>
-        <hr/>
-        <div>
-          <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name != 'virtual']"/>
-          <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name = 'virtual']"/>
-        </div>
-        <xsl:apply-templates mode="mappings" select="/themes/mappings"/>
+      <h1>FLYS3 - Themes</h1>
+      <div>
+      <h2><a name="theme-groups">Theme groups</a> (<xsl:value-of select="count(/themes/themegroup)"/> groups)</h2>
+      <ul>
+        <xsl:apply-templates mode="header" select="/themes/themegroup[@name != 'virtual']"/>
+        <xsl:apply-templates mode="header" select="/themes/themegroup[@name = 'virtual']"/>
+      </ul>
+      </div>
+      <div>
+        <h2><a href="#mappings">Mappings</a> (<xsl:value-of select="count(/themes/mappings/mapping)"/> mappings)</h2>
+      </div>
+      <hr/>
+      <div>
+        <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name != 'virtual']"/>
+        <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name = 'virtual']"/>
+      </div>
+      <xsl:apply-templates mode="mappings" select="/themes/mappings"/>
     </body>
     </html>
   </xsl:template>
@@ -141,6 +162,7 @@
   <xsl:template match="text()" mode="header"/>
   <xsl:template match="text()" mode="theme-groups"/>
   <xsl:template match="text()" mode="theme-list"/>
+  <xsl:template match="text()" mode="sub-themes"/>
   <xsl:template match="text()" mode="theme-fields"/>
   <xsl:template match="text()" mode="theme-inherits"/>
   <xsl:template match="text()" mode="mappings"/>

http://dive4elements.wald.intevation.org