Cleanup xsl. Use templates and proper indentation so that this is actually human readable now.

This commit is contained in:
Steve Checkoway
2006-10-01 08:56:25 +00:00
parent 9a936c8aaf
commit 49645f302c
+75 -31
View File
@@ -3,7 +3,7 @@
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Lua"> <xsl:template match="/">
<html> <html>
<head> <head>
<title>StepMania LUA Information</title> <title>StepMania LUA Information</title>
@@ -18,9 +18,15 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
td { td {
border: 1px solid border: 1px solid
} }
hr {
width: 90%
}
.trigger { .trigger {
cursor: pointer cursor: pointer
} }
.footer {
text-align: center
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
function Toggle( id ) function Toggle( id )
@@ -44,36 +50,69 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</script> </script>
</head> </head>
<body> <body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="Lua">
<div> <div>
<h2>StepMania LUA Information</h2> <h2>StepMania LUA Information</h2>
<table><tr> <table>
<tr>
<th><a href="#Singletons">Singletons</a></th> <th><a href="#Singletons">Singletons</a></th>
<th><a href="#Classes">Classes</a></th> <th><a href="#Classes">Classes</a></th>
<th><a href="#GlobalFunctions">Global Functions</a></th> <th><a href="#GlobalFunctions">Global Functions</a></th>
<th><a href="#Enums">Enums</a></th> <th><a href="#Enums">Enums</a></th>
<th><a href="#Constants">Constants</a></th> <th><a href="#Constants">Constants</a></th>
</tr></table> </tr>
</table>
</div> </div>
<xsl:apply-templates select="Singletons" />
<xsl:apply-templates select="Classes" />
<xsl:apply-templates select="GlobalFunctions" />
<xsl:apply-templates select="Enums" />
<xsl:apply-templates select="Constants" />
<hr />
<p class="footer">
Generated for <xsl:value-of select="Version" /> on
<xsl:value-of select="Date" />.
</p>
</xsl:template>
<xsl:template match="Singletons">
<div> <div>
<a name="Singletons" /> <a name="Singletons" />
<h3>Singletons</h3> <h3>Singletons</h3>
<ul> <ul>
<xsl:for-each select="Singletons/Singleton"> <xsl:for-each select="Singleton">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
<li><a> <li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="@class" /></xsl:attribute> <xsl:attribute name="href">#<xsl:value-of select="@class" /></xsl:attribute>
<xsl:value-of select="@name" /> <xsl:value-of select="@name" />
</a></li> </a>
</li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</div> </div>
</xsl:template>
<xsl:template match="Classes">
<div> <div>
<a name="Classes" /> <a name="Classes" />
<h3>Classes</h3> <h3>Classes</h3>
<xsl:for-each select="Classes/Class"> <xsl:apply-templates select="Class">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
</xsl:apply-templates>
</div>
</xsl:template>
<xsl:template match="Class">
<div> <div>
<a> <a>
<xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
@@ -83,40 +122,53 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<img src="closed.gif"> <img src="closed.gif">
<xsl:attribute name="id">img_<xsl:value-of select="@name" /></xsl:attribute> <xsl:attribute name="id">img_<xsl:value-of select="@name" /></xsl:attribute>
</img> </img>
Class <xsl:value-of select="@name" /></a> Class <xsl:value-of select="@name" />
</a>
<xsl:if test="@base != ''"> <xsl:if test="@base != ''">
: <a> <xsl:text> : </xsl:text>
<a>
<xsl:attribute name="href">#<xsl:value-of select="@base" /></xsl:attribute> <xsl:attribute name="href">#<xsl:value-of select="@base" /></xsl:attribute>
<xsl:value-of select="@base" /> <xsl:value-of select="@base" />
</a> </a>
</xsl:if> </xsl:if>
<ul style="display: none"> <ul style="display: none">
<xsl:attribute name="id">list_<xsl:value-of select="@name" /></xsl:attribute> <xsl:attribute name="id">list_<xsl:value-of select="@name" /></xsl:attribute>
<xsl:for-each select="Function"> <xsl:apply-templates select="Function">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
<li><xsl:value-of select="@name" /></li> </xsl:apply-templates>
</xsl:for-each>
</ul> </ul>
</div> </div>
</xsl:for-each> </xsl:template>
</div>
<xsl:template match="GlobalFunctions">
<div> <div>
<a name="GlobalFunctions" /> <a name="GlobalFunctions" />
<h3>Global Functions</h3> <h3>Global Functions</h3>
<ul> <ul>
<xsl:for-each select="GlobalFunctions/Function"> <xsl:apply-templates select="Function">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
<li><xsl:value-of select="@name" /></li> </xsl:apply-templates>
</xsl:for-each>
</ul> </ul>
</div> </div>
</xsl:template>
<xsl:template match="Function">
<li><xsl:value-of select="@name" /></li>
</xsl:template>
<xsl:template match="Enums">
<div> <div>
<a name="Enums" /> <a name="Enums" />
<h3>Enums</h3> <h3>Enums</h3>
<xsl:for-each select="Enums/Enum"> <xsl:apply-templates select="Enum">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
</xsl:apply-templates>
</div>
</xsl:template>
<xsl:template match="Enum">
<div> <div>
<a class="trigger"> <a class="trigger">
<xsl:attribute name="onClick">Toggle('<xsl:value-of select="@name" />')</xsl:attribute> <xsl:attribute name="onClick">Toggle('<xsl:value-of select="@name" />')</xsl:attribute>
@@ -140,9 +192,10 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</table> </table>
<br /> <br />
</div> </div>
</xsl:for-each> </xsl:template>
</div>
<xsl:template match="Constants">
<div> <div>
<a name="Constants" /> <a name="Constants" />
<h3>Constants</h3> <h3>Constants</h3>
@@ -151,7 +204,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<th>Constant</th> <th>Constant</th>
<th>Value</th> <th>Value</th>
</tr> </tr>
<xsl:for-each select="Constants/Constant"> <xsl:for-each select="Constant">
<xsl:sort select="@name" /> <xsl:sort select="@name" />
<tr> <tr>
<td><xsl:value-of select="@name" /></td> <td><xsl:value-of select="@name" /></td>
@@ -159,16 +212,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</tr> </tr>
</xsl:for-each> </xsl:for-each>
</table> </table>
<br/> <br />
</div> </div>
<hr width="90%" />
<center>
<p>Generated for <xsl:value-of select="Version" /> on
<xsl:value-of select="Date" />.</p>
</center>
</body>
</html>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>