-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParliamentToWebTable.xsl
53 lines (46 loc) · 1.42 KB
/
ParliamentToWebTable.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:p="http://www.parlamento.pt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="p:politicians">
<table>
<tr>
<td>Code</td>
<td>Party</td>
<td>Age</td>
<td>Name</td>
<td>Number of Interventions</td>
<td>Number of Sessions</td>
</tr>
<xsl:apply-templates />
</table>
</xsl:template>
<xsl:template match="p:politician">
<xsl:param name="code" select="./@code" />
<xsl:param name="party" select="./@party" />
<xsl:param name="age" select="./@age" />
<xsl:param name="name" select="./text()" />
<xsl:param name="nParlInterv" select="count(//p:parliament-interventions[./session/speech[@politician = $code]])" />
<xsl:param name="nSessions" select="count(//p:session[./speech/@politician = $code])" />
<tr>
<td><xsl:value-of select="$code" /></td>
<td><xsl:value-of select="$party" /></td>
<td><xsl:value-of select="$age" /></td>
<td><xsl:value-of select="$name" /></td>
<td><xsl:value-of select="$nParlInterv" /></td>
<td><xsl:value-of select="$nSessions" /></td>
</tr>
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>