• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0"?>
2
3<!--
4
5Copyright 2008 VMware, Inc.
6All Rights Reserved.
7
8Permission is hereby granted, free of charge, to any person obtaining a
9copy of this software and associated documentation files (the
10"Software"), to deal in the Software without restriction, including
11without limitation the rights to use, copy, modify, merge, publish,
12distribute, sub license, and/or sell copies of the Software, and to
13permit persons to whom the Software is furnished to do so, subject to
14the following conditions:
15
16The above copyright notice and this permission notice (including the
17next paragraph) shall be included in all copies or substantial portions
18of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
24ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28!-->
29
30<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
31
32	<xsl:output method="html" />
33
34	<xsl:strip-space elements="*" />
35
36	<xsl:template match="/trace">
37		<html>
38			<head>
39				<title>Gallium Trace</title>
40			</head>
41			<style>
42				body {
43					font-family: verdana, sans-serif;
44					font-size: 11px;
45					font-weight: normal;
46					text-align : left;
47				}
48
49				.fun {
50					font-weight: bold;
51				}
52
53				.var {
54					font-style: italic;
55				}
56
57				.typ {
58					display: none;
59				}
60
61				.lit {
62					color: #0000ff;
63				}
64
65				.ptr {
66					color: #008000;
67				}
68			</style>
69			<body>
70				<ol class="calls">
71					<xsl:apply-templates/>
72				</ol>
73			</body>
74		</html>
75	</xsl:template>
76
77	<xsl:template match="call">
78		<li>
79			<xsl:attribute name="value">
80				<xsl:apply-templates select="@no"/>
81			</xsl:attribute>
82			<span class="fun">
83				<xsl:value-of select="@class"/>
84				<xsl:text>::</xsl:text>
85				<xsl:value-of select="@method"/>
86			</span>
87			<xsl:text>(</xsl:text>
88			<xsl:apply-templates select="arg"/>
89			<xsl:text>)</xsl:text>
90			<xsl:apply-templates select="ret"/>
91		</li>
92	</xsl:template>
93
94	<xsl:template match="arg|member">
95			<xsl:apply-templates select="@name"/>
96			<xsl:text> = </xsl:text>
97			<xsl:apply-templates />
98			<xsl:if test="position() != last()">
99				<xsl:text>, </xsl:text>
100			</xsl:if>
101	</xsl:template>
102
103	<xsl:template match="ret">
104		<xsl:text> = </xsl:text>
105		<xsl:apply-templates />
106	</xsl:template>
107
108	<xsl:template match="bool|int|uint|float|enum">
109		<span class="lit">
110			<xsl:value-of select="text()"/>
111		</span>
112	</xsl:template>
113
114	<xsl:template match="bytes">
115		<span class="lit">
116			<xsl:text>...</xsl:text>
117		</span>
118	</xsl:template>
119
120	<xsl:template match="string">
121		<span class="lit">
122			<xsl:text>"</xsl:text>
123			<xsl:call-template name="break">
124				<xsl:with-param name="text" select="text()"/>
125			</xsl:call-template>
126			<xsl:text>"</xsl:text>
127		</span>
128	</xsl:template>
129
130	<xsl:template match="array|struct">
131		<xsl:text>{</xsl:text>
132		<xsl:apply-templates />
133		<xsl:text>}</xsl:text>
134	</xsl:template>
135
136	<xsl:template match="elem">
137		<xsl:apply-templates />
138		<xsl:if test="position() != last()">
139			<xsl:text>, </xsl:text>
140		</xsl:if>
141	</xsl:template>
142
143	<xsl:template match="null">
144		<span class="ptr">
145			<xsl:text>NULL</xsl:text>
146		</span>
147	</xsl:template>
148
149	<xsl:template match="ptr">
150		<span class="ptr">
151			<xsl:value-of select="text()"/>
152		</span>
153	</xsl:template>
154
155	<xsl:template match="@name">
156		<span class="var">
157			<xsl:value-of select="."/>
158		</span>
159	</xsl:template>
160
161	<xsl:template name="break">
162		<xsl:param name="text" select="."/>
163		<xsl:choose>
164			<xsl:when test="contains($text, '&#xa;')">
165				<xsl:value-of select="substring-before($text, '&#xa;')"/>
166				<br/>
167				<xsl:call-template name="break">
168					 <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
169				</xsl:call-template>
170			</xsl:when>
171			<xsl:otherwise>
172				<xsl:value-of select="$text"/>
173			</xsl:otherwise>
174		</xsl:choose>
175	</xsl:template>
176
177	<xsl:template name="replace">
178		<xsl:param name="text"/>
179		<xsl:param name="from"/>
180		<xsl:param name="to"/>
181		<xsl:choose>
182			<xsl:when test="contains($text,$from)">
183				<xsl:value-of select="concat(substring-before($text,$from),$to)"/>
184				<xsl:call-template name="replace">
185					<xsl:with-param name="text" select="substring-after($text,$from)"/>
186					<xsl:with-param name="from" select="$from"/>
187					<xsl:with-param name="to" select="$to"/>
188				</xsl:call-template>
189			</xsl:when>
190			<xsl:otherwise>
191				<xsl:value-of select="$text"/>
192			</xsl:otherwise>
193		</xsl:choose>
194	</xsl:template>
195
196</xsl:transform>
197