sascha@3262: <?xml version="1.0" encoding="UTF-8"?>
sascha@3262: <xsl:stylesheet
sascha@3262:   version="1.0"
sascha@3262:   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
sascha@3262: 
sascha@3262:   <xsl:output method="xml" encoding="UTF-8"
sascha@3262:     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
sascha@3262:     doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes"/>
sascha@3262: 
sascha@3262: 
sascha@3262:   <xsl:template match="/themes/themegroup" mode="header">
sascha@3262:     <li><a href="#tg-{@name}"><xsl:value-of select="@name"/></a> (<xsl:value-of select="count(theme)"/> themes)</li>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="field" mode="theme-inherits">
sascha@3262:     <tr>
sascha@3262:         <td><i><xsl:value-of select="@name"/></i> (<a
sascha@3262:             href="#theme-{../../../@name}-{../../@name}"><xsl:value-of select="../../@name"/></a>)</td>
sascha@3262:         <td><xsl:value-of select="@display"/></td>
sascha@3262:         <td><xsl:value-of select="@type"/></td>
sascha@3262:         <td><xsl:value-of select="@default"/></td>
sascha@3262:         <td><xsl:value-of select="@hints"/></td>
sascha@3262:     </tr>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="field" mode="theme-fields">
sascha@3262:     <tr>
sascha@3262:         <td><xsl:value-of select="@name"/></td>
sascha@3262:         <td><xsl:value-of select="@display"/></td>
sascha@3262:         <td><xsl:value-of select="@type"/></td>
sascha@3262:         <td><xsl:value-of select="@default"/></td>
sascha@3262:         <td><xsl:value-of select="@hints"/></td>
sascha@3262:     </tr>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="inherit" mode="theme-inherits">
sascha@3262:     <xsl:variable name="target" select="@from"/>
sascha@3262:     <xsl:apply-templates
sascha@3262:         select="../../../theme[@name = $target]/inherits/inherit | /themes/themegroup/theme[@type='virtual' and @name=$target]/inherits/inherit"
sascha@3262:         mode="theme-inherits"/>
sascha@3262:     <xsl:apply-templates
sascha@3262:         select="../../../theme[@name = $target]/fields/field | /themes/themegroup/theme[@type='virtual' and @name=$target]/fields/field"
sascha@3262:         mode="theme-inherits"/>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3267:   <xsl:template match="theme" mode="sub-themes">
sascha@3267:     <xsl:variable name="tname" select="../@name"/>
sascha@3267:     <xsl:variable name="name" select="@name"/>
sascha@3267:     <li><a href="#theme-{$tname}-{$name}"><xsl:value-of select="$tname"/>/<xsl:value-of select="$name"/></a></li>
sascha@3267:   </xsl:template>
sascha@3267: 
sascha@3262:   <xsl:template match="theme" mode="theme-groups">
sascha@3262:     <div>
sascha@3267:       <h4>[<a href="#theme-groups">Groups</a>] [<a href="#tg-{../@name}"><xsl:value-of select="../@name"/></a>] <a 
sascha@3267:           name="theme-{../@name}-{@name}">Theme '<xsl:value-of select="@name"/>'<xsl:if
sascha@3267:         test="@type = 'virtual'"> (virtual)</xsl:if></a></h4>
sascha@3267: 
sascha@3267:       <xsl:variable name="tname" select="../@name"/>
sascha@3267:       <xsl:variable name="is-virtual" select="$tname = 'virtual'"/>
sascha@3267:       <xsl:variable name="name" select="@name"/>
sascha@3267: 
sascha@3267:       <xsl:if
sascha@3267:         test="count(/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]) &gt; 0">
sascha@3267:       <strong>Sub themes</strong>
sascha@3267:       <ul>
sascha@3267:         <xsl:apply-templates
sascha@3267:             select="/themes/themegroup[$is-virtual or @name=$tname or @name='virtual']/theme[inherits/inherit/@from=$name]"
sascha@3267:             mode="sub-themes"/>
sascha@3267:       </ul>
sascha@3267:       </xsl:if>
sascha@3267: 
sascha@3262:       <table border="1" cellspacing="0" width="80%" summary="Definition of theme {@name}">
sascha@3262:         <tr>
sascha@3262:           <th>Name</th>
sascha@3262:           <th>Display</th>
sascha@3262:           <th>Type</th>
sascha@3262:           <th>Default</th>
sascha@3262:           <th>Hints</th>
sascha@3262:         </tr>
sascha@3262:         <xsl:apply-templates mode="theme-inherits" select="inherits/inherit"/>
sascha@3262:         <xsl:apply-templates mode="theme-fields" select="fields/field"/>
sascha@3262:       </table>
sascha@3262:     </div>
sascha@3262:     <hr/>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="theme" mode="theme-list">
sascha@3262:     <li><a href="#theme-{../@name}-{@name}"><xsl:value-of select="@name"/></a></li>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="/themes/themegroup" mode="theme-groups">
sascha@3262:     <div>
sascha@3262:         <h2><a name="tg-{@name}">Theme group '<xsl:value-of select="@name"/>'</a></h2>
sascha@3262:         <div>
sascha@3262:           <h3>Theme List</h3>
sascha@3262:           <ul>
sascha@3262:             <xsl:apply-templates mode="theme-list" select="theme"/>
sascha@3262:           </ul>
sascha@3262:         </div>
sascha@3262:         <div>
sascha@3262:           <h3>Theme Definitions</h3>
sascha@3262:           <xsl:apply-templates mode="theme-groups" select="theme"/>
sascha@3262:         </div>
sascha@3262:     </div>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="mapping" mode="mappings">
sascha@3262:     <xsl:variable name="target" select="@to"/>
sascha@3262:     <tr>
sascha@3262:       <td><xsl:value-of select="@from"/></td>
sascha@3262:       <td><a 
sascha@3262:         href="#theme-{/themes/themegroup/theme[@name = $target][1]/../@name}-{$target}"
sascha@3262:       ><xsl:value-of select="@to"/></a></td>
sascha@3262:       <td><xsl:if test="@pattern"><pre><xsl:value-of select="@pattern"/></pre></xsl:if></td>
sascha@3262:       <td><xsl:if test="@masterAttr"><pre><xsl:value-of select="@masterAttr"/></pre></xsl:if></td>
sascha@3262:     </tr>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="mappings" mode="mappings">
sascha@3262:     <div>
sascha@3262:       <h3><a name="mappings">Mappings</a></h3>
sascha@3262:       <table width="80%" border="1" cellspacing="0" summary="Mappings from facets to themes">
sascha@3262:       <tr>
sascha@3262:         <th>From</th>
sascha@3262:         <th>To</th>
sascha@3262:         <th>Pattern</th>
sascha@3262:         <th>Condition</th>
sascha@3262:       </tr>
sascha@3262:       <xsl:apply-templates select="mapping" mode="mappings"/>
sascha@3262:       </table>
sascha@3262:     </div>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="/">
sascha@3262:     <html>
sascha@3262:     <head>
sascha@3262:         <title>FLYS3 - Themes</title>
sascha@3262:     </head>
sascha@3262:     <body>
sascha@3267:       <h1>FLYS3 - Themes</h1>
sascha@3267:       <div>
sascha@3267:       <h2><a name="theme-groups">Theme groups</a> (<xsl:value-of select="count(/themes/themegroup)"/> groups)</h2>
sascha@3267:       <ul>
sascha@3267:         <xsl:apply-templates mode="header" select="/themes/themegroup[@name != 'virtual']"/>
sascha@3267:         <xsl:apply-templates mode="header" select="/themes/themegroup[@name = 'virtual']"/>
sascha@3267:       </ul>
sascha@3267:       </div>
sascha@3267:       <div>
sascha@3267:         <h2><a href="#mappings">Mappings</a> (<xsl:value-of select="count(/themes/mappings/mapping)"/> mappings)</h2>
sascha@3267:       </div>
sascha@3267:       <hr/>
sascha@3267:       <div>
sascha@3267:         <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name != 'virtual']"/>
sascha@3267:         <xsl:apply-templates mode="theme-groups" select="/themes/themegroup[@name = 'virtual']"/>
sascha@3267:       </div>
sascha@3267:       <xsl:apply-templates mode="mappings" select="/themes/mappings"/>
sascha@3262:     </body>
sascha@3262:     </html>
sascha@3262:   </xsl:template>
sascha@3262: 
sascha@3262:   <xsl:template match="text()"/>
sascha@3262:   <xsl:template match="text()" mode="header"/>
sascha@3262:   <xsl:template match="text()" mode="theme-groups"/>
sascha@3262:   <xsl:template match="text()" mode="theme-list"/>
sascha@3267:   <xsl:template match="text()" mode="sub-themes"/>
sascha@3262:   <xsl:template match="text()" mode="theme-fields"/>
sascha@3262:   <xsl:template match="text()" mode="theme-inherits"/>
sascha@3262:   <xsl:template match="text()" mode="mappings"/>
sascha@3262: 
sascha@3262: </xsl:stylesheet>