david_williams | 2e87efa | 2008-09-01 02:56:08 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
| 2 | <xsl:stylesheet |
| 3 | version="1.0" |
| 4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 5 | |
| 6 | <xsl:output |
| 7 | method="html" |
| 8 | indent="yes" /> |
| 9 | |
| 10 | <xsl:template match="/"> |
| 11 | <html> |
| 12 | <body> |
| 13 | <xsl:apply-templates select="compiler" /> |
| 14 | </body> |
| 15 | </html> |
| 16 | </xsl:template> |
| 17 | |
| 18 | <xsl:template match="compiler"> |
| 19 | <h2>Compiler Report</h2> |
| 20 | <p> |
| 21 | Compiler: |
| 22 | <xsl:value-of select="@name" /> |
| 23 | <xsl:text> </xsl:text> |
| 24 | Version: |
| 25 | <xsl:value-of select="@version" /> |
| 26 | </p> |
| 27 | |
| 28 | <xsl:apply-templates select="stats" /> |
| 29 | |
| 30 | <xsl:apply-templates select="sources" /> |
| 31 | </xsl:template> |
| 32 | |
| 33 | <xsl:template |
| 34 | name="stats" |
| 35 | match="stats"> |
| 36 | |
| 37 | <p> |
| 38 | Number of source files: |
| 39 | <xsl:value-of select="count(..//source)" /> |
| 40 | Number of classfiles: |
| 41 | <xsl:value-of select="number_of_classfiles/@value" /> |
| 42 | </p> |
| 43 | <p> |
| 44 | Problems: |
| 45 | <xsl:value-of select="problem_summary/@problems" /> |
| 46 | (Errors: |
| 47 | <xsl:value-of select="problem_summary/@errors" /> |
| 48 | Warnings: |
| 49 | <xsl:value-of select="problem_summary/@warnings" /> |
| 50 | ) |
| 51 | </p> |
| 52 | </xsl:template> |
| 53 | |
| 54 | |
| 55 | <xsl:template |
| 56 | name="sources" |
| 57 | match="sources"> |
| 58 | |
| 59 | <xsl:if test="count(source) > 0"> |
| 60 | |
| 61 | <dl> |
| 62 | <xsl:for-each select="source"> |
| 63 | |
| 64 | <xsl:variable |
| 65 | name="package" |
| 66 | select="normalize-space(@package)"> |
| 67 | </xsl:variable> |
| 68 | <xsl:variable |
| 69 | name="path" |
| 70 | select="normalize-space(@path)"> |
| 71 | </xsl:variable> |
| 72 | <xsl:variable |
| 73 | name="classname" |
| 74 | select="substring-after($path, $package)"> |
| 75 | </xsl:variable> |
| 76 | <xsl:if test="count(problems) > 0"> |
| 77 | <dt style="font-weight: bold; color: black"> |
| 78 | Source File: |
| 79 | <xsl:value-of select="$package" /> |
| 80 | <xsl:value-of select="$classname" /> |
| 81 | </dt> |
| 82 | <xsl:apply-templates select="problems"> |
| 83 | <xsl:with-param name="classname"> |
| 84 | <xsl:value-of select="$classname" /> |
| 85 | </xsl:with-param> |
| 86 | </xsl:apply-templates> |
| 87 | </xsl:if> |
| 88 | </xsl:for-each> |
| 89 | </dl> |
| 90 | |
| 91 | </xsl:if> |
| 92 | |
| 93 | </xsl:template> |
| 94 | |
| 95 | <xsl:template match="problems"> |
| 96 | <xsl:param name="classname" /> |
| 97 | <xsl:for-each select="problem"> |
| 98 | |
| 99 | <dd style="font-weight: normal; color: black"> |
| 100 | <xsl:value-of select="position()" /> |
| 101 | <xsl:text>. </xsl:text> |
| 102 | <xsl:value-of select="@severity" /> |
| 103 | <xsl:text>: </xsl:text> |
| 104 | <xsl:value-of select="@id" /> |
| 105 | <xsl:variable |
| 106 | name="lineNumber" |
| 107 | select="@line"> |
| 108 | </xsl:variable> |
| 109 | <xsl:for-each select="message"> |
| 110 | <p |
| 111 | style="margin-left: +.5in; font-size: -1; margin-top: 0;margin-bottom:0;"> |
| 112 | <small> |
| 113 | <xsl:value-of select="@value" /> |
| 114 | </small> |
| 115 | </p> |
| 116 | </xsl:for-each> |
| 117 | <xsl:for-each select="source_context"> |
| 118 | <xsl:variable |
| 119 | name="pre" |
| 120 | select="substring(@value,0,(@sourceStart + 1))"> |
| 121 | </xsl:variable> |
| 122 | <xsl:variable |
| 123 | name="main" |
| 124 | select="substring(@value,(@sourceStart + 1),(((@sourceEnd + 1) - (@sourceStart + 1)) + 1))"> |
| 125 | </xsl:variable> |
| 126 | <xsl:variable |
| 127 | name="end" |
| 128 | select="substring(@value,(@sourceEnd + 2))"> |
| 129 | </xsl:variable> |
| 130 | |
| 131 | <p |
| 132 | style="margin-left: +.5in; font-size: -2; margin-top: 0;margin-bottom:0;"> |
| 133 | <xsl:value-of select="substring($classname,2)" /> |
| 134 | : |
| 135 | </p> |
| 136 | <p |
| 137 | style="margin-left: +.5in; font-size: -2;font-family: monospace; margin-top: 0;margin-bottom:0;"> |
| 138 | <xsl:value-of select="$lineNumber" /> |
| 139 | : |
| 140 | <xsl:value-of select="$pre" /> |
| 141 | <b> |
| 142 | <u> |
| 143 | <xsl:value-of select="$main" /> |
| 144 | </u> |
| 145 | </b> |
| 146 | <xsl:value-of select="$end" /> |
| 147 | </p> |
| 148 | </xsl:for-each> |
| 149 | </dd> |
| 150 | </xsl:for-each> |
| 151 | |
| 152 | |
| 153 | </xsl:template> |
| 154 | |
| 155 | </xsl:stylesheet> |