david_williams | 0b74c59 | 2007-04-09 06:11:35 +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>Version: |
| 24 | <xsl:value-of select="@version" /> |
| 25 | </p> |
| 26 | |
| 27 | <xsl:apply-templates select="stats"/> |
| 28 | |
| 29 | <xsl:apply-templates select="sources" /> |
| 30 | </xsl:template> |
| 31 | |
| 32 | <xsl:template |
| 33 | name="stats" |
| 34 | match="stats"> |
| 35 | |
| 36 | <p>Number of source files: <xsl:value-of select="count(..//source)"/> |
| 37 | Number of classfiles: <xsl:value-of select="number_of_classfiles/@value"/> |
| 38 | </p> |
| 39 | <p> |
| 40 | Problems: <xsl:value-of select="problem_summary/@problems"/> |
| 41 | (Errors: <xsl:value-of select="problem_summary/@errors"/> |
| 42 | Warnings: <xsl:value-of select="problem_summary/@warnings"/> |
| 43 | ) |
| 44 | </p> |
| 45 | </xsl:template> |
| 46 | |
| 47 | |
| 48 | <xsl:template |
| 49 | name="sources" |
| 50 | match="sources"> |
| 51 | |
| 52 | <xsl:if test="count(source) > 0"> |
| 53 | |
| 54 | <dl> |
| 55 | <xsl:for-each select="source"> |
| 56 | |
| 57 | <xsl:variable |
| 58 | name="package" |
| 59 | select="normalize-space(@package)"> |
| 60 | </xsl:variable> |
| 61 | <xsl:variable |
| 62 | name="path" |
| 63 | select="normalize-space(@path)"> |
| 64 | </xsl:variable> |
| 65 | <xsl:variable |
| 66 | name="classname" |
| 67 | select="substring-after($path, $package)"> |
| 68 | </xsl:variable> |
| 69 | <xsl:if test="count(problems) > 0"> |
| 70 | <dt style="font-weight: bold; color: black"> |
| 71 | Source File: |
| 72 | <xsl:value-of select="$package" /> |
| 73 | <xsl:value-of select="$classname" /> |
| 74 | </dt> |
| 75 | <xsl:apply-templates select="problems" > |
| 76 | <xsl:with-param name="classname"><xsl:value-of select="$classname" /></xsl:with-param> |
| 77 | </xsl:apply-templates> |
| 78 | </xsl:if> |
| 79 | </xsl:for-each> |
| 80 | </dl> |
| 81 | |
| 82 | </xsl:if> |
| 83 | |
| 84 | </xsl:template> |
| 85 | |
| 86 | <xsl:template match="problems"> |
| 87 | <xsl:param name="classname" /> |
| 88 | <xsl:for-each select="problem"> |
| 89 | |
| 90 | <dd style="font-weight: normal; color: black"> |
| 91 | <xsl:value-of select="position()"/> |
| 92 | <xsl:text>. </xsl:text> |
| 93 | <xsl:value-of select="@severity" /> |
| 94 | <xsl:text>: </xsl:text> |
| 95 | <xsl:value-of select="@id" /> |
| 96 | <xsl:variable |
| 97 | name="lineNumber" |
| 98 | select="@line"> |
| 99 | </xsl:variable> |
| 100 | <xsl:for-each select="message"> |
| 101 | <p style="margin-left: +.5in; font-size: -1; margin-top: 0;margin-bottom:0;"> |
| 102 | <small> |
| 103 | <xsl:value-of select="@value" /> |
| 104 | </small> |
| 105 | </p> |
| 106 | </xsl:for-each> |
| 107 | <xsl:for-each select="source_context"> |
| 108 | <xsl:variable |
| 109 | name="pre" |
| 110 | select="substring(@value,0,(@sourceStart + 1))"> |
| 111 | </xsl:variable> |
| 112 | <xsl:variable |
| 113 | name="main" |
| 114 | select="substring(@value,(@sourceStart + 1),(((@sourceEnd + 1) - (@sourceStart + 1)) + 1))"> |
| 115 | </xsl:variable> |
| 116 | <xsl:variable |
| 117 | name="end" |
| 118 | select="substring(@value,(@sourceEnd + 2))"> |
| 119 | </xsl:variable> |
| 120 | |
| 121 | <p style="margin-left: +.5in; font-size: -2; margin-top: 0;margin-bottom:0;"> |
| 122 | <xsl:value-of select="substring($classname,2)"/>: |
| 123 | </p> |
| 124 | <p style="margin-left: +.5in; font-size: -2;font-family: monospace; margin-top: 0;margin-bottom:0;"> |
| 125 | <xsl:value-of select="$lineNumber"/>: |
| 126 | <xsl:value-of select="$pre" /> |
| 127 | <b><u> |
| 128 | <xsl:value-of select="$main" /> |
| 129 | </u></b> |
| 130 | <xsl:value-of select="$end" /> |
| 131 | </p> |
| 132 | </xsl:for-each> |
| 133 | </dd> |
| 134 | </xsl:for-each> |
| 135 | |
| 136 | |
| 137 | </xsl:template> |
| 138 | |
| 139 | </xsl:stylesheet> |