-
Notifications
You must be signed in to change notification settings - Fork 3
/
support_info_by_support_statement.xslt
108 lines (100 loc) · 3.35 KB
/
support_info_by_support_statement.xslt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="statement_id" match="statement" use="@id"/>
<xsl:key name="note_id" match="note" use="@id"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="support_info.css" />
</head>
<body>
<h1>Package Support Status</h1>
<p>This is current as of <xsl:value-of select="/package_support/@current_as"/></p>
<p>The following colors are displayed to indicate the remaining support life of packages from today's date, which is <span id="thetime">Enable JavaScript for this calculation</span> :</p>
<table>
<thead>
<tr>
<th>Background Color</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr class="supported">
<td>Green</td>
<td>More than 180 days of support remaining</td>
</tr>
<tr class="unsupported">
<td>Red</td>
<td>This package is currently End of Life</td>
</tr>
<tr class="unsupportedin60">
<td>Orange</td>
<td>Fewer than 60 days of support remaining</td>
</tr>
<tr class="unsupportedin180">
<td>Yellow</td>
<td>Fewer than 180 days of support remaining</td>
</tr>
</tbody>
</table>
<ul>
<xsl:for-each select="/package_support/statements/statement">
<li><a href="#{@id}"><xsl:value-of select="summary"/></a></li>
</xsl:for-each>
</ul>
<xsl:for-each select="/package_support/statements/statement">
<h2><a name="{@id}"><xsl:value-of select="summary"/></a></h2>
<p><a href="{link}"><xsl:value-of select="link"/></a></p>
<p><xsl:value-of select="text"/></p>
<h3>Package List</h3>
<table cellspacing="0" id="pkglist-{@id}">
<tr>
<th>Package</th>
<th>Days Remaining</th>
<th>Note</th>
</tr>
<xsl:for-each select="packages/package">
<tr class="{../../@marker}">
<td><xsl:value-of select="@name"/></td>
<td></td>
<td><xsl:value-of select="key('note_id', @note )"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
<script lang="JavaScript">
var thetime = new Date(Date());
document.getElementById("thetime").innerHTML = thetime.toISOString();
var support_dates = {
<xsl:for-each select="/package_support/statements/statement">"pkglist-<xsl:value-of select="@id"/>" : "<xsl:value-of select="@start_date"/>",</xsl:for-each>
};
for (const [s_id, start_date] of Object.entries(support_dates)) {
rows = document.getElementById(s_id).getElementsByTagName("tr")
if (rows.length < 2) {
continue; // Maybe no packages
}
newclass = rows[1].getAttribute("class");
sd = new Date(start_date);
if (sd == undefined || start_date == "" || sd == NaN)
continue;
var days_remaining = ((sd.getTime() - thetime.getTime()) / (1 * 24 * 60 * 60 * 1000)).toFixed();
if (days_remaining < 0) {
newclass = "unsupported";
} else if (days_remaining > 180) {
newclass = "supported";
} else if (days_remaining > 60) {
newclass = "unsupportedin180";
} else {
newclass = "unsupportedin60";
}
for (i=1; i < rows.length; i++) {
rows[i].setAttribute("class", newclass);
rows[i].getElementsByTagName("td")[1].innerHTML = days_remaining;
}
}
</script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>