pmd(build): Rework ruleset's XSL for website to support new rulesets coming from new language support

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7520 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse
2011-12-05 23:16:52 +00:00
parent 71794decad
commit b4bae0969a
2 changed files with 54 additions and 46 deletions

View File

@@ -15,9 +15,13 @@
<xsl:template match="ruleset">
<!-- Opening the appropriate file -->
<xsl:variable name="filename" select="@file"/>
<xsl:variable name="rules_file" select="document($filename)"/>
<!-- Adding to our tree all the nodes present there -->
<xsl:copy-of select="$rules_file"/>
<xsl:element name="language">
<xsl:attribute name="name"><xsl:value-of select="@language"/></xsl:attribute>
<!-- Adding to our tree all the nodes present there -->
<xsl:variable name="rules_file" select="document($filename)"/>
<xsl:copy-of select="$rules_file"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View File

@@ -1,50 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
BSD-style license; for more info see http://pmd.sourceforge.net/license.html
BSD-style license; for more info see http://pmd.sourceforge.net/license.html
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<!-- FUTURE: Externalising text to allow i18n documnetation -->
<xsl:variable name="Title" select="'PMD Rulesets index'"/>
<xsl:variable name="PageDesc" select="'List of rulesets and rules contained in each ruleset.'"/>
<!-- FUTURE: Externalising text to allow i18n documnetation -->
<xsl:variable name="Title" select="'PMD Rulesets index'"/>
<xsl:variable name="PageDesc" select="'List of rulesets and rules contained in each ruleset.'"/>
<xsl:template match="rulesets">
<document>
<properties>
<author email="mikkey@sourceforge.net">Miguel Griffa</author>
<title><xsl:value-of select="$Title"/></title>
</properties>
<body>
<section name="Current Rulesets">
<p><xsl:value-of select="$PageDesc"/></p>
<xsl:template match="rulesets">
<document>
<properties>
<author email="mikkey@sourceforge.net">Miguel Griffa</author>
<title><xsl:value-of select="$Title"/></title>
</properties>
<body>
<section name="Current Rulesets">
<p><xsl:value-of select="$PageDesc"/></p>
<ul>
<xsl:for-each select="./language/ruleset">
<xsl:sort select="@name"/>
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute>
<xsl:value-of select="@name"/>
</a>: <xsl:value-of select="description"/>
</li>
</xsl:for-each>
</ul>
<xsl:for-each select="language">
<xsl:variable name="language"><xsl:value-of select="@name"/></xsl:variable>
<xsl:for-each select="ruleset">
<xsl:element name="a">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
</xsl:element>
<subsection>
<xsl:attribute name="name"><xsl:value-of select="@name"/> (<xsl:value-of select="$language"/>)</xsl:attribute>
<ul>
<xsl:for-each select="ruleset">
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="@name"/></xsl:attribute>
<xsl:value-of select="@name"/>
</a>: <xsl:value-of select="description"/>
</li>
</xsl:for-each>
<xsl:for-each select="./rule">
<li> <xsl:value-of select="@name"/>: <xsl:value-of select="description"/></li>
</xsl:for-each>
</ul>
<xsl:for-each select="ruleset">
<subsection>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:for-each select="./rule">
<li> <xsl:value-of select="@name"/>: <xsl:value-of select="description"/></li>
</xsl:for-each>
</subsection>
</xsl:for-each>
</section>
<!--
TODO
<section name="Rules by name">
<p>List of rules sorted alphabetically.</p>
</section>
-->
</body>
</document>
</xsl:template>
</xsl:stylesheet>
</subsection>
</xsl:for-each>
</xsl:for-each>
</section>
</body>
</document>
</xsl:template>
</xsl:stylesheet>