blob: b11a8c4bcddb43552c8975cca224a9b479d55922 [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>
Guang Zhu67a526d52015-04-29 21:15:30 -070024 <title><xsl:value-of select="api-coverage/@title" /></title>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070025 <script type="text/javascript">
26 function toggleVisibility(id) {
27 element = document.getElementById(id);
28 if (element.style.display == "none") {
29 element.style.display = "";
30 } else {
31 element.style.display = "none";
32 }
33 }
34 </script>
35 <style type="text/css">
Brian Muramatsu16fdad82010-12-02 17:13:44 -080036 body {
37 background-color: #CCCCCC;
38 font-family: sans-serif;
39 margin: 10px;
40 }
41
42 .info {
43 margin-bottom: 10px;
44 }
45
46 .apks, .package, .class {
47 cursor: pointer;
48 text-decoration: underline;
49 }
50
51 .packageDetails {
52 padding-left: 20px;
53 }
54
55 .classDetails {
56 padding-left: 40px;
57 }
58
59 .method {
60 font-family: courier;
61 white-space: nowrap;
62 }
63
64 .red {
Brian Muramatsu37e73412012-01-03 15:12:19 -080065 background-color: #FF6666;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080066 }
67
68 .yellow {
Brian Muramatsu37e73412012-01-03 15:12:19 -080069 background-color: #FFFF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080070 }
71
72 .green {
Brian Muramatsu37e73412012-01-03 15:12:19 -080073 background-color: #66FF66;
Brian Muramatsu16fdad82010-12-02 17:13:44 -080074 }
Brian Muramatsud9423e02012-01-05 16:00:46 -080075
76 .deprecated {
77 text-decoration: line-through;
78 }
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070079 </style>
80 </head>
81 <body>
Tsu Chiang Chuange0158bf2013-07-19 10:46:24 -070082 <h1><xsl:value-of select="api-coverage/@title" /></h1>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070083 <div class="info">
84 Generated: <xsl:value-of select="api-coverage/@generatedTime" />
85 </div>
Keun young Parke156dae2012-08-24 18:26:47 -070086 <div class="total">
87 Total:&nbsp;<xsl:value-of select="api-coverage/total/@coveragePercentage" />%
88 &nbsp;(<xsl:value-of select="api-coverage/total/@numCovered" />/<xsl:value-of select="api-coverage/total/@numTotal" />)
89 </div>
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070090 <div class="apks" onclick="toggleVisibility('sourceApks')">
Guang Zhu67a526d52015-04-29 21:15:30 -070091 Source Modules (<xsl:value-of select="count(api-coverage/debug/sources/apk)" />)
Brian Muramatsu2f8eead2010-09-24 14:56:43 -070092 </div>
93 <div id="sourceApks" style="display: none">
94 <ul>
95 <xsl:for-each select="api-coverage/debug/sources/apk">
96 <li><xsl:value-of select="@path" /></li>
97 </xsl:for-each>
98 </ul>
99 </div>
100 <ul>
101 <xsl:for-each select="api-coverage/api/package">
102 <xsl:call-template name="packageOrClassListItem">
103 <xsl:with-param name="bulletClass" select="'package'" />
104 </xsl:call-template>
105 <div class="packageDetails" id="{@name}" style="display: none">
106 <ul>
107 <xsl:for-each select="class">
108 <xsl:call-template name="packageOrClassListItem">
109 <xsl:with-param name="bulletClass" select="'class'" />
110 </xsl:call-template>
111 <div class="classDetails" id="{@name}" style="display: none">
112 <xsl:for-each select="constructor">
113 <xsl:call-template name="methodListItem" />
114 </xsl:for-each>
115 <xsl:for-each select="method">
116 <xsl:call-template name="methodListItem" />
117 </xsl:for-each>
118 </div>
119 </xsl:for-each>
120 </ul>
121 </div>
122 </xsl:for-each>
123 </ul>
124 </body>
125 </html>
126 </xsl:template>
127
128 <xsl:template name="packageOrClassListItem">
129 <xsl:param name="bulletClass" />
Brian Muramatsud9423e02012-01-05 16:00:46 -0800130
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700131 <xsl:variable name="colorClass">
132 <xsl:choose>
133 <xsl:when test="@coveragePercentage &lt;= 50">red</xsl:when>
134 <xsl:when test="@coveragePercentage &lt;= 80">yellow</xsl:when>
135 <xsl:otherwise>green</xsl:otherwise>
136 </xsl:choose>
137 </xsl:variable>
138
Brian Muramatsud9423e02012-01-05 16:00:46 -0800139 <xsl:variable name="deprecatedClass">
140 <xsl:choose>
141 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
142 <xsl:otherwise></xsl:otherwise>
143 </xsl:choose>
144 </xsl:variable>
145
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700146 <li class="{$bulletClass}" onclick="toggleVisibility('{@name}')">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800147 <span class="{$colorClass} {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700148 <b><xsl:value-of select="@name" /></b>
149 &nbsp;<xsl:value-of select="@coveragePercentage" />%
150 &nbsp;(<xsl:value-of select="@numCovered" />/<xsl:value-of select="@numTotal" />)
151 </span>
152 </li>
153 </xsl:template>
154
155 <xsl:template name="methodListItem">
Brian Muramatsud9423e02012-01-05 16:00:46 -0800156
157 <xsl:variable name="deprecatedClass">
158 <xsl:choose>
159 <xsl:when test="@deprecated = 'true'">deprecated</xsl:when>
160 <xsl:otherwise></xsl:otherwise>
161 </xsl:choose>
162 </xsl:variable>
163
164 <span class="method {$deprecatedClass}">
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700165 <xsl:choose>
166 <xsl:when test="@covered = 'true'">[X]</xsl:when>
167 <xsl:otherwise>[ ]</xsl:otherwise>
168 </xsl:choose>
169 <xsl:if test="@returnType != ''">&nbsp;<xsl:value-of select="@returnType" /></xsl:if>
170 <b>&nbsp;<xsl:value-of select="@name" /></b><xsl:call-template name="formatParameters" />
171 </span>
172 <br />
173 </xsl:template>
Brian Muramatsud9423e02012-01-05 16:00:46 -0800174
Brian Muramatsu2f8eead2010-09-24 14:56:43 -0700175 <xsl:template name="formatParameters">(<xsl:for-each select="parameter">
176 <xsl:value-of select="@type" />
177 <xsl:if test="not(position() = last())">,&nbsp;</xsl:if>
178 </xsl:for-each>)
179 </xsl:template>
180
181</xsl:stylesheet>
182