-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathday.xsl
158 lines (144 loc) · 4.4 KB
/
day.xsl
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
exclude-result-prefixes="xsl str">
<xsl:param name="day"/>
<xsl:output method="html"/>
<xsl:template match="schedule">
<html>
<head>
<title>
Day <xsl:value-of select="$day"/> -
<xsl:value-of select="conference/title"/>
</title>
<link rel="stylesheet" type="text/css" href="style.css?20161227133700" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<xsl:apply-templates select="conference/title"/>
<xsl:apply-templates select="day[@index=$day]"/>
<script type="text/javascript">
function clickEvent(el) {
console.log('toggle', el.classList);
el.classList.toggle('expand');
}
for(var el of document.getElementsByTagName('article')) {
(function(el) {
el.onclick = clickEvent.bind(this, el);
})(el);
}
</script>
<footer>
<p>
By <a href="https://spaceboyz.net/~astro/">Astro</a>,
(<a href="https://github.com/voc/36C3_schedule">data</a>,
<a href="https://github.com/c3d2/36c3-everything">code</a>)
</p>
</footer>
</body>
</html>
</xsl:template>
<xsl:template match="conference/title">
<h1><xsl:value-of select="."/></h1>
</xsl:template>
<xsl:template match="schedule/day">
<h2 id="day{@index}">
Day <xsl:value-of select="@index"/>
(<xsl:value-of select="@date"/>)
</h2>
<section>
<xsl:apply-templates select="event"/>
</section>
</xsl:template>
<xsl:template match="event">
<xsl:variable name="expandable">
<xsl:if test="abstract and string-length(abstract) > 0">
expandable
</xsl:if>
</xsl:variable>
<xsl:if test="start != preceding-sibling::*[1]/start">
<article class="time">
<p>
<xsl:value-of select="start"/>
</p>
</article>
</xsl:if>
<article class="{str:replace(str:replace(room, ' ', '_'), '.', '')} {$expandable}"
lang="{language}">
<div class="meta">
<p class="time">
<xsl:value-of select="start"/>
<span class="duration">
<xsl:text>+</xsl:text>
<xsl:value-of select="duration"/>
</span>
</p>
<p class="room">
<xsl:choose>
<xsl:when test="starts-with(room, 'Assembly:')">
<i>
<xsl:value-of select="str:replace(room, 'Assembly:', '')"/>
</i>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="room"/>
</xsl:otherwise>
</xsl:choose>
</p>
</div>
<div class="header">
<!--xsl:if test="logo and string-length(logo) > 0">
<img class="logo"
src="{base_url}{logo}"/>
</xsl:if-->
<h3>
<xsl:choose>
<xsl:when test="url">
<a href="{url}">
<xsl:value-of select="title"/>
</a>
</xsl:when>
<xsl:when test="links/link">
<a href="{links/link[last()]}">
<xsl:value-of select="title"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="title"/>
</xsl:otherwise>
</xsl:choose>
</h3>
<xsl:if test="subtitle and string-length(subtitle) > 0">
<h4>
<xsl:value-of select="subtitle"/>
</h4>
</xsl:if>
</div>
<p class="abstract">
<xsl:value-of select="abstract"/>
<xsl:text> </xsl:text>
<xsl:value-of select="description"/>
</p>
<ul class="speakers">
<xsl:apply-templates select="persons"/>
</ul>
</article>
</xsl:template>
<xsl:template match="person">
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="name">
<xsl:value-of select="name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li>
<xsl:value-of select="$name"/>
</li>
</xsl:template>
</xsl:stylesheet>