-
Notifications
You must be signed in to change notification settings - Fork 0
/
counter2.xsl
65 lines (56 loc) · 2.55 KB
/
counter2.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="http://www.tei-c.org/ns/1.0"
xmlns:e="http://distantreading.net/eltec/ns" exclude-result-prefixes="xs t e" version="2.0">
<xsl:output method="html"/>
<xsl:param name="corpus">XXX</xsl:param>
<xsl:param name="catalog">yes</xsl:param>
<xsl:template match="/">
<!-- <xsl:variable name="ROOT" select="document('tagCounts.xml')"/>
-->
<xsl:variable name="ROOT" select="."/>
<xsl:variable name="corpora">cze,deu,eng,fra,gre,gsw,hrv,hun,ita,lav,nor,pol,por,rom,slv,spa,srp,swe,ukr</xsl:variable>
<xsl:variable name="tags">back,body,corr,div,emph,foreign,front,gap,head,hi,l,label,milestone,note,p,pb,quote,ref,trailer</xsl:variable>
<html>
<link rel="stylesheet" type="text/css" href="../css/summary.css"/>
<head><title>Tag counts per corpus</title></head>
<body>
<h2>Tags used within <text> only</h2>
<table>
<thead>
<tr>
<td/>
<xsl:for-each select="tokenize($corpora,',')">
<xsl:variable name="corpus"><xsl:value-of select="."/></xsl:variable>
<td><xsl:value-of select="$corpus"/><br/>
<xsl:value-of select="$ROOT//tagcount[@corpus=$corpus]/@words"/><br/>
<xsl:value-of select="$ROOT//tagcount[@corpus=$corpus]/@texts"/></td>
</xsl:for-each>
</tr>
</thead>
<xsl:for-each select="tokenize($tags,',')">
<xsl:variable name="tag"><xsl:value-of select="."/>
</xsl:variable>
<tr>
<td class="label"><xsl:value-of select="$tag"/></td>
<xsl:for-each select="tokenize($corpora,',')">
<xsl:variable name="corpus"><xsl:value-of select="."/>
</xsl:variable>
<xsl:variable name="count">
<xsl:value-of select="$ROOT//tagcount[@corpus=$corpus]/node[@name=$tag]/@count"/>
</xsl:variable>
<td>
<xsl:choose>
<xsl:when test="$count gt '0'">
<xsl:value-of select="$count"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body></html>
</xsl:template>
</xsl:stylesheet>