blob: 1ac34025fc6a26cb6caf5e9390a32a0dfa52b369 [file] [log] [blame]
Brian Muramatsu2f8eead2010-09-24 14:56:43 -07001<?xml version="1.0" encoding="utf-8"?>
2<!--
3 * Copyright (C) 2010 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 -->
17
18<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
19<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
20 <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
21 <xsl:template match="/">
22 <html>
23 <head>
24 <script type="text/javascript">
25 function toggleVisibility(id) {
26 element = document.getElementById(id);
27 if (element.style.display == "none") {
28 element.style.display = "";
29 } else {
30 element.style.display = "none";
31 }
32 }
33 </script>
34 <style type="text/css">
Brian Muramatsu16fdad82010-12-02 17:13:44 -080035 body {
36 background-color: #CCCCCC;
37 font-family: sans-serif;
38 margin: 10px;
39 }
40
41 .info {
42 margin-bottom: 10px;
43 }
44
45 .apks, .package, .class {
46 cursor: pointer;
47 text-decoration: underline;
48 }
49
50 .packageDetails {
51 padding-left: 20px;
52 }
53
54 .classDetails {
55 padding-left: 40px;
56 }
57
58 .method {
59 font-family: courier;
60 white-space: nowrap;
61 }
62
63 .red {
Brian Muramatsu37e73412012-01-03 15:12:19 -080064 background-color: #FF6666;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080065 }
66
67 .yellow {
Brian Muramatsu37e73412012-01-03 15:12:19 -080068 background-color: #FFFF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080069 }
70
71 .green {
Brian Muramatsu37e73412012-01-03 15:12:19 -080072 background-color: #66FF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080073 }
Brian Muramatsud9423e02012-01-05 16:00:46 -080074
75 .deprecated {
76 text-decoration: line-through;
77 }
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070078 </style>
79 </head>
80 <body>
Tsu Chiang Chuange0158bf2013-07-19 10:46:24 -070081 <h1><xsl:value-of select="api-coverage/@title" /></h1>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070082 <div class="info">
83 Generated: <xsl:value-of select="api-coverage/@generatedTime" />
84 </div>
Keun young Parke156dae2012-08-24 18:26:47 -070085 <div class="total">
86 Total:&nbsp;<xsl:value-of select="api-coverage/total/@coveragePercentage" />%
87 &nbsp;(<xsl:value-of select="api-coverage/total/@numCovered" />/<xsl:value-of select="api-coverage/total/@numTotal" />)
88 </div>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070089 <div class="apks" onclick="toggleVisibility('sourceApks')">
90 Source APKs (<xsl:value-of select="count(api-coverage/debug/sources/apk)" />)
91 </div>
92 <div id="sourceApks" style="display: none">
93 <ul>
94 <xsl:for-each select="api-coverage/debug/sources/apk">
95 <li><xsl:value-of select="@path" /></li>
96 </xsl:for-each>
97 </ul>
98 </div>
99 <ul>
100 <xsl:for-each select="api-coverage/api/package">
101 <xsl:call-template name="packageOrClassListItem">
102 <xsl:with-param name="bulletClass" select="'package'" />
103 </xsl:call-template>
104 <div class="packageDetails" id="{@name}" style="display: none">
105 <ul>
106 <xsl:for-each select="class">
107 <xsl:call-template name="packageOrClassListItem">
108 <xsl:with-param name="bulletClass" select="'class'" />
109 </xsl:call-template>
110 <div class="classDetails" id="{@name}" style="display: none">
111 <xsl:for-each select="constructor">
112 <xsl:call-template name="methodListItem" />
113 </xsl:for-each>
114 <xsl:for-each select="method">
115 <xsl:call-template name="methodListItem" />
116 </xsl:for-each>
117 </div>
118 </xsl:for-each>
119 </ul>
120 </div>
121 </xsl:for-each>
122 </ul>
123 </body>
124 </html>
125 </xsl:template>
126
127 <xsl:template name="packageOrClassListItem">
128 <xsl:param name="bulletClass" />
Brian Muramatsud9423e02012-01-05 16:00:46 -0800129
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700130 <xsl:variable name="colorClass">
131 <xsl:choose>
132 <xsl:when test="@coveragePercentage &lt;= 50">red</xsl:when>
133 <xsl:when test="@coveragePercentage &lt;= 80">yellow</xsl:when>
134 <xsl:otherwise>green</xsl:otherwise>
135 </xsl:choose>
136 </xsl:variable>
137
Brian Muramatsud9423e02012-01-05 16:00:46 -0800138 <xsl:variable name="deprecatedClass">
139 <xsl:choose>
140 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
141 <xsl:otherwise></xsl:otherwise>
142 </xsl:choose>
143 </xsl:variable>
144
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700145 <li class="{$bulletClass}" onclick="toggleVisibility('{@name}')">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800146 <span class="{$colorClass} {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700147 <b><xsl:value-of select="@name" /></b>
148 &nbsp;<xsl:value-of select="@coveragePercentage" />%
149 &nbsp;(<xsl:value-of select="@numCovered" />/<xsl:value-of select="@numTotal" />)
150 </span>
151 </li>
152 </xsl:template>
153
154 <xsl:template name="methodListItem">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800155
156 <xsl:variable name="deprecatedClass">
157 <xsl:choose>
158 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
159 <xsl:otherwise></xsl:otherwise>
160 </xsl:choose>
161 </xsl:variable>
162
163 <span class="method {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700164 <xsl:choose>
165 <xsl:when test="@covered = 'true'">[X]</xsl:when>
166 <xsl:otherwise>[ ]</xsl:otherwise>
167 </xsl:choose>
168 <xsl:if test="@returnType != ''">&nbsp;<xsl:value-of select="@returnType" /></xsl:if>
169 <b>&nbsp;<xsl:value-of select="@name" /></b><xsl:call-template name="formatParameters" />
170 </span>
171 <br />
172 </xsl:template>
Brian Muramatsud9423e02012-01-05 16:00:46 -0800173
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700174 <xsl:template name="formatParameters">(<xsl:for-each select="parameter">
175 <xsl:value-of select="@type" />
176 <xsl:if test="not(position() = last())">,&nbsp;</xsl:if>
177 </xsl:for-each>)
178 </xsl:template>
179
180</xsl:stylesheet>
181