1<?xml version="1.0"?>
2
3<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5 <xsl:output method='html' encoding="UTF-8"
6 doctype-public="-//W3C//DTD HTML 4.01//EN"
7 doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
8
9 <xsl:template match="logfile">
10 <html>
11 <head>
12 <script type="text/javascript" src="jquery.min.js"></script>
13 <script type="text/javascript" src="jquery-ui.min.js"></script>
14 <script type="text/javascript" src="treebits.js" />
15 <link rel="stylesheet" href="logfile.css" type="text/css" />
16 <title>Log File</title>
17 </head>
18 <body>
19 <h1>VM build log</h1>
20 <p>
21 <a href="javascript:" class="logTreeExpandAll">Expand all</a> |
22 <a href="javascript:" class="logTreeCollapseAll">Collapse all</a>
23 </p>
24 <ul class='toplevel'>
25 <xsl:for-each select='line|nest'>
26 <li>
27 <xsl:apply-templates select='.'/>
28 </li>
29 </xsl:for-each>
30 </ul>
31
32 <xsl:if test=".//*[@image]">
33 <h1>Screenshots</h1>
34 <ul class="vmScreenshots">
35 <xsl:for-each select='.//*[@image]'>
36 <li><a href="{@image}"><xsl:value-of select="@image" /></a></li>
37 </xsl:for-each>
38 </ul>
39 </xsl:if>
40
41 </body>
42 </html>
43 </xsl:template>
44
45
46 <xsl:template match="nest">
47
48 <!-- The tree should be collapsed by default if all children are
49 unimportant or if the header is unimportant. -->
50 <xsl:variable name="collapsed" select="not(./head[@expanded]) and count(.//*[@error]) = 0"/>
51
52 <xsl:variable name="style"><xsl:if test="$collapsed">display: none;</xsl:if></xsl:variable>
53
54 <xsl:if test="line|nest">
55 <a href="javascript:" class="logTreeToggle">
56 <xsl:choose>
57 <xsl:when test="$collapsed"><xsl:text>+</xsl:text></xsl:when>
58 <xsl:otherwise><xsl:text>-</xsl:text></xsl:otherwise>
59 </xsl:choose>
60 </a>
61 <xsl:text> </xsl:text>
62 </xsl:if>
63
64 <xsl:apply-templates select='head'/>
65
66 <!-- Be careful to only generate <ul>s if there are <li>s, otherwise it’s malformed. -->
67 <xsl:if test="line|nest">
68
69 <ul class='nesting' style="{$style}">
70 <xsl:for-each select='line|nest'>
71
72 <!-- Is this the last line? If so, mark it as such so that it
73 can be rendered differently. -->
74 <xsl:variable name="class"><xsl:choose><xsl:when test="position() != last()">line</xsl:when><xsl:otherwise>lastline</xsl:otherwise></xsl:choose></xsl:variable>
75
76 <li class='{$class}'>
77 <span class='lineconn' />
78 <span class='linebody'>
79 <xsl:apply-templates select='.'/>
80 </span>
81 </li>
82 </xsl:for-each>
83 </ul>
84 </xsl:if>
85
86 </xsl:template>
87
88
89 <xsl:template match="head|line">
90 <code>
91 <xsl:if test="@error">
92 <xsl:attribute name="class">errorLine</xsl:attribute>
93 </xsl:if>
94 <xsl:if test="@warning">
95 <xsl:attribute name="class">warningLine</xsl:attribute>
96 </xsl:if>
97 <xsl:if test="@priority = 3">
98 <xsl:attribute name="class">prio3</xsl:attribute>
99 </xsl:if>
100
101 <xsl:if test="@type = 'serial'">
102 <xsl:attribute name="class">serial</xsl:attribute>
103 </xsl:if>
104
105 <xsl:if test="@machine">
106 <xsl:choose>
107 <xsl:when test="@type = 'serial'">
108 <span class="machine"><xsl:value-of select="@machine"/># </span>
109 </xsl:when>
110 <xsl:otherwise>
111 <span class="machine"><xsl:value-of select="@machine"/>: </span>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:if>
115
116 <xsl:choose>
117 <xsl:when test="@image">
118 <a href="{@image}"><xsl:apply-templates/></a>
119 </xsl:when>
120 <xsl:otherwise>
121 <xsl:apply-templates/>
122 </xsl:otherwise>
123 </xsl:choose>
124 </code>
125 </xsl:template>
126
127
128 <xsl:template match="storeref">
129 <em class='storeref'>
130 <span class='popup'><xsl:apply-templates/></span>
131 <span class='elided'>/...</span><xsl:apply-templates select='name'/><xsl:apply-templates select='path'/>
132 </em>
133 </xsl:template>
134
135</xsl:stylesheet>