Update of /cvsroot/metamorphosis/antlets/checkstyle/src/resources/stylesheets
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5562/checkstyle/src/resources/stylesheets
Modified Files:
checkstyle2xdocs.xsl
Added Files:
checkstyle2xdocs-bak.xsl
Log Message:
updated checkstyle antlet
--- NEW FILE: checkstyle2xdocs-bak.xsl ---
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect">
<!--$Header:
/cvsroot/metamorphosis/antlets/checkstyle/src/resources/stylesheets/checkstyle2xdocs-bak.xsl,v
1.1 2004/02/26 17:05:27 homeijer Exp $ -->
<!-- xsl:output method = "xml" indent="yes" encoding="UTF-8" / -->
<xsl:output method = "xml" doctype-public="-//APACHE//DTD Documentation
V1.1//EN" doctype-system="./dtd/document-v11.dtd"/>
<xsl:param name="basedir">src/java</xsl:param>
<xsl:template match="/">
<xsl:apply-templates select="/checkstyle"/>
<xsl:apply-templates select="/checkstyle" mode="book"/>
<xsl:apply-templates select="/checkstyle/file"/>
</xsl:template>
<xsl:template match="/checkstyle">
<document>
<header>
<title>Checkstyle Analysis</title>
</header>
<body>
<section>
<title>Checkstyle Analysis</title>
<p>This page details coding standard
errors found in the
Java source code for this
project. These are style
errors and as such do not
prevent the code from running,
however, many people argue that
well styled code is
easily readable, and that
easily readable code is easier
to maintain.</p>
<xsl:variable name = "total-errors"
select =
"count(file/error)" />
<section>
<title>Summary</title>
<p>Summary of <xsl:value-of
select="$total-errors"/>
errors</p>
<table>
<tr>
<th>Errors</th>
<th>File</th>
</tr>
<xsl:for-each select =
"file">
<xsl:sort
select="count(error)"
order="descending" data-type="number"/>
<xsl:if test =
"contains(@name,'.java')">
<xsl:variable name = "current-errors" select
= "count(error)" />
<tr>
<xsl:choose>
<xsl:when test="$current-errors = 0"
>
<td>0</td>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:value-of
select="$current-errors"
/>
</td>
</xsl:otherwise>
</xsl:choose>
<td>
<xsl:apply-templates select="." mode="displayName"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</section>
<p>Generated by <link
href="http://checkstyle.sourceforge.net/">Checkstyle</link>
and <link
href="http://ant.apache.org">Ant</link>.</p>
</section>
</body>
</document>
</xsl:template>
<xsl:template match="file">
<xsl:variable name="cleanName">
<xsl:value-of select="translate(@name,':/\\','_..')"/>
</xsl:variable>
<xsl:variable name="filename">
<xsl:apply-templates select="." mode="fileName"/><xsl:text>.xml</xsl:text>
</xsl:variable>
<redirect:write select="$filename">
<xsl:variable name = "file-errors" select =
"count(error)" />
<document>
<header>
<title>Checkstyle Analysis of
<xsl:apply-templates select="." mode="displayName"/> </title>
</header>
<body>
<section>
<title>Checkstyle
Analysis</title>
<p>This page details coding
standard errors found in the
Java source code for
this project. These are style
errors and as such do
not prevent the code from
running, however, many
people argue that well styled
code is easily
readable, and that easily readable
code is easier to
maintain.</p>
<xsl:variable name =
"total-errors" select =
"count(file/error)" />
<section>
<title>Details</title>
<p>
<xsl:choose>
<xsl:when test="$file-errors = 0">
<table>
<tr>
<th>
<xsl:value-of select="@name"/>
</th>
</tr>
<tr>
<td>No errors :-)</td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<table>
<th colspan="2">
<xsl:value-of select="@name"/>
</th>
<tr>
<th>Line</th>
<th>Error</th>
</tr>
<xsl:apply-templates select =
"error" />
</table>
</xsl:otherwise>
</xsl:choose>
</p>
</section>
<p>Generated by <link
href="http://checkstyle.sourceforge.net/">Checkstyle</link>
and <link
href="http://ant.apache.org">Ant</link>
.</p>
</section>
</body>
</document>
</redirect:write>
</xsl:template>
<xsl:template match="error">
<tr>
<td width="6%">
<xsl:value-of select="@line"/>
</td>
<td>
<xsl:value-of select="@message"/>
</td>
</tr>
</xsl:template>
<xsl:template match="/checkstyle" mode="book">
<redirect:write file="book.xml">
<book software="@SOFTWARE@" title="@name"
copyright="@year@ Krysalis Project"
xmlns:xlink="http://www.w3.org/1999/xlink">
<menu label="Project">
<menu-item label="back"
href="../index.html"/>
</menu>
<menu label="Analysis">
<menu-item label="Summary"
href="index.html"/>
<xsl:for-each select = "file">
<menu-item >
<xsl:attribute
name="label">
<xsl:apply-templates select="." mode="displayName"/>
</xsl:attribute>
<xsl:attribute
name="href">
<xsl:apply-templates select="." mode="fileName"/><xsl:text>.html</xsl:text>
</xsl:attribute>
</menu-item>
</xsl:for-each>
</menu>
</book>
</redirect:write>
</xsl:template>
<xsl:template match="file" mode="fileName">
<xsl:if test = "contains(@name,'.java')">
<xsl:value-of
select="substring-before(translate(@name,':/\\','_..'),'.java')"/>
</xsl:if>
<xsl:if test = "contains(@name,'package.html')">
<xsl:value-of
select="substring-after(substring-before(translate(substring-after(@name,$basedir),':/\\','_..'),'.package.html'),'.')"/>
</xsl:if>
</xsl:template>
<xsl:template match="file" mode="displayName">
<xsl:if test = "contains(@name,'.java')">
<xsl:value-of
select="substring-before(translate(@name,':/\\','_..'),'.java')"/>
</xsl:if>
<xsl:if test = "contains(@name,'package.html')">
<xsl:value-of
select="substring-after(substring-before(translate(substring-after(@name,$basedir),':/\\','_..'),'.package.html'),'.')"/>
</xsl:if> </xsl:template>
</xsl:stylesheet>
Index: checkstyle2xdocs.xsl
===================================================================
RCS file:
/cvsroot/metamorphosis/antlets/checkstyle/src/resources/stylesheets/checkstyle2xdocs.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** checkstyle2xdocs.xsl 25 Feb 2004 22:09:29 -0000 1.1
--- checkstyle2xdocs.xsl 26 Feb 2004 17:05:27 -0000 1.2
***************
*** 8,18 ****
<xsl:param name="basedir">src/java</xsl:param>
- <xsl:template match="/">
- <xsl:apply-templates select="/checkstyle"/>
- <xsl:apply-templates select="/checkstyle" mode="book"/>
- <xsl:apply-templates select="/checkstyle/file"/>
- </xsl:template>
! <xsl:template match="/checkstyle">
<document>
<header>
--- 8,13 ----
<xsl:param name="basedir">src/java</xsl:param>
! <xsl:template match="checkstyle">
<document>
<header>
***************
*** 28,191 ****
easily readable, and that
easily readable code is easier
to maintain.</p>
- <xsl:variable name = "total-errors"
select =
- "count(file/error)" />
- <section>
- <title>Summary</title>
- <p>Summary of <xsl:value-of
select="$total-errors"/>
- errors</p>
- <table>
- <tr>
- <th>Errors</th>
- <th>File</th>
- </tr>
- <xsl:for-each select =
"file">
- <xsl:sort
select="count(error)"
-
order="descending" data-type="number"/>
- <xsl:if test =
"contains(@name,'.java')">
-
<xsl:variable name = "current-errors" select
-
= "count(error)" />
- <tr>
-
<xsl:choose>
-
<xsl:when test="$current-errors = 0"
-
>
-
<td>0</td>
-
</xsl:when>
-
<xsl:otherwise>
-
<td>
-
<xsl:value-of
-
select="$current-errors"
-
/>
-
</td>
-
</xsl:otherwise>
-
</xsl:choose>
-
<td>
-
<xsl:apply-templates select="." mode="displayName"/>
-
</td>
- </tr>
- </xsl:if>
- </xsl:for-each>
- </table>
- </section>
- <p>Generated by <link
-
href="http://checkstyle.sourceforge.net/">Checkstyle</link>
- and <link
href="http://ant.apache.org">Ant</link>.</p>
</section>
</body>
</document>
</xsl:template>
! <xsl:template match="file">
! <xsl:variable name="cleanName">
! <xsl:value-of select="translate(@name,':/\\','_..')"/>
! </xsl:variable>
! <xsl:variable name="filename">
! <xsl:apply-templates select="." mode="fileName"/><xsl:text>.xml</xsl:text>
! </xsl:variable>
! <redirect:write select="$filename">
! <xsl:variable name = "file-errors" select =
"count(error)" />
! <document>
! <header>
! <title>Checkstyle Analysis of
<xsl:apply-templates select="." mode="displayName"/> </title>
! </header>
! <body>
! <section>
! <title>Checkstyle
Analysis</title>
! <p>This page details coding
standard errors found in the
! Java source code for
this project. These are style
! errors and as such do
not prevent the code from
! running, however, many
people argue that well styled
! code is easily
readable, and that easily readable
! code is easier to
maintain.</p>
! <xsl:variable name =
"total-errors" select =
! "count(file/error)" />
! <section>
! <title>Details</title>
! <p>
! <xsl:choose>
!
<xsl:when test="$file-errors = 0">
!
<table>
!
<tr>
!
<th>
!
<xsl:value-of select="@name"/>
</th>
!
</tr>
!
<tr>
!
<td>No errors :-)</td>
!
</tr>
!
</table>
!
</xsl:when>
!
<xsl:otherwise>
!
<table>
!
<th colspan="2">
!
<xsl:value-of select="@name"/>
!
</th>
!
<tr>
!
<th>Line</th>
!
<th>Error</th>
!
</tr>
!
<xsl:apply-templates select =
!
"error" />
!
</table>
!
</xsl:otherwise>
! </xsl:choose>
! </p>
! </section>
! <p>Generated by <link
!
href="http://checkstyle.sourceforge.net/">Checkstyle</link>
! and <link
href="http://ant.apache.org">Ant</link>
! .</p>
! </section>
! </body>
! </document>
! </redirect:write>
</xsl:template>
! <xsl:template match="error">
<tr>
! <td width="6%">
! <xsl:value-of select="@line"/>
! </td>
! <td>
! <xsl:value-of select="@message"/>
! </td>
</tr>
</xsl:template>
- <xsl:template match="/checkstyle" mode="book">
- <redirect:write file="book.xml">
- <book software="@SOFTWARE@" title="@name"
- copyright="@year@ Krysalis Project"
- xmlns:xlink="http://www.w3.org/1999/xlink">
- <menu label="Project">
- <menu-item label="back"
href="../index.html"/>
- </menu>
- <menu label="Analysis">
- <menu-item label="Summary"
href="index.html"/>
- <xsl:for-each select = "file">
- <menu-item >
- <xsl:attribute
name="label">
-
<xsl:apply-templates select="." mode="displayName"/>
- </xsl:attribute>
- <xsl:attribute
name="href">
-
<xsl:apply-templates select="." mode="fileName"/><xsl:text>.html</xsl:text>
- </xsl:attribute>
- </menu-item>
- </xsl:for-each>
- </menu>
- </book>
- </redirect:write>
- </xsl:template>
- <xsl:template match="file" mode="fileName">
- <xsl:if test = "contains(@name,'.java')">
- <xsl:value-of
select="substring-before(translate(@name,':/\\','_..'),'.java')"/>
- </xsl:if>
- <xsl:if test = "contains(@name,'package.html')">
- <xsl:value-of
-
select="substring-after(substring-before(translate(substring-after(@name,$basedir),':/\\','_..'),'.package.html'),'.')"/>
- </xsl:if>
- </xsl:template>
- <xsl:template match="file" mode="displayName">
- <xsl:if test = "contains(@name,'.java')">
- <xsl:value-of
select="substring-before(translate(@name,':/\\','_..'),'.java')"/>
- </xsl:if>
- <xsl:if test = "contains(@name,'package.html')">
- <xsl:value-of
-
select="substring-after(substring-before(translate(substring-after(@name,$basedir),':/\\','_..'),'.package.html'),'.')"/>
- </xsl:if> </xsl:template>
</xsl:stylesheet>
--- 23,51 ----
easily readable, and that
easily readable code is easier
to maintain.</p>
</section>
+ <xsl:apply-templates/>
</body>
</document>
</xsl:template>
!
! <xsl:template match="file">
! <section>
! <title><xsl:value-of select="@name" /></title>
! <table>
! <tr>
! <th>line</th>
! <th>message</th>
! </tr>
! <xsl:apply-templates/>
! <tr><th colspan="3"></th></tr>
! </table>
! </section>
</xsl:template>
!
! <xsl:template match="error">
<tr>
! <td><xsl:value-of select="@line" /></td>
! <td><xsl:value-of select="@message" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
|