-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathships.xsl
99 lines (85 loc) · 2.25 KB
/
ships.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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html>
<head>
<title>Fallen Galaxy Ships Counters</title>
<link rel="stylesheet" href="compos.css"/>
<link rel="stylesheet" href="ships.css"/>
</head>
<body>
<xsl:for-each select="ships/class">
<h1><xsl:value-of select="name"/></h1>
<xsl:for-each select="ship">
<xsl:sort select="ship/name"/>
<div class="compo allFactions">
<xsl:choose>
<xsl:when test="@faction">
<xsl:attribute name="class">
compo <xsl:value-of select="@faction"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<h3>
<div class="factionimage"/>
<xsl:value-of select="name"/>
</h3>
<div class="ship mainship">
<div class="shipimage {translate(name, ' ', '')}"/>
</div>
<!-- FIXME: Table… for *once*, it’d be best in a table. I think. -->
<div class="counters">
<div class="strongAndWeak">
<div class="strong">
<h4>Strong against</h4>
<!-- FIXME: Template -->
<xsl:call-template name="showShipsIfHas">
<xsl:with-param name="elem" select="strong" />
</xsl:call-template>
</div>
<div class="weak">
<h4>Weak against</h4>
<xsl:call-template name="showShipsIfHas">
<xsl:with-param name="elem" select="weak" />
</xsl:call-template>
</div>
</div>
<xsl:choose>
<xsl:when test="bestwith">
<div class="bestwith">
<h4>Best with</h4>
<div class="ships">
<xsl:apply-templates select="bestwith" />
</div>
</div>
</xsl:when>
</xsl:choose>
</div>
</div>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template name="showShipsIfHas">
<xsl:param name="elem" />
<div class="ships">
<xsl:choose>
<xsl:when test="$elem">
<xsl:apply-templates select="$elem" />
</xsl:when>
<xsl:otherwise>
<div>
none in particular
</div>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="strong | weak | bestwith">
<div class="ship">
<div class="shipimage {translate(., ' ', '')}"/>
</div>
</xsl:template>
</xsl:stylesheet>