UNPKG

4.6 kBXMLView Raw
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fll="http://fll-tools.com/applications/scoring/v1/challenge.xsd">
5
6 <xsl:template match="/">
7 <html>
8 <head>
9 <style>
10 body {
11 font-family: verdana;
12 counter-reset: mission;
13 }
14 .mission {
15 border: 1px solid silver;
16 border-radius: 4px;
17 margin: 10px;
18 padding: 10px;
19 counter-increment: mission;
20 }
21 .mission h2:before {
22 content: counter(mission);
23 border: 1px solid silver;
24 border-radius: 100px;
25 padding: 4px;
26 display: inline-block;
27 background-color: whitesmoke;
28 width: 20px;
29 height: 20px;
30 line-height: 20px;
31 text-align: center;
32 margin-left: -25px;
33 margin-right: 10px;
34 }
35 .mission h2 {
36 font-size: inherit;
37 margin: 0;
38 }
39 .objective {
40 overflow: auto;
41 }
42 .objective .desc {
43 float: left;
44 margin-left: 20px;
45 }
46 .objective .values {
47 float: right;
48 font-weight: bold;
49 }
50 .objective .values span {
51 margin: 0 10px;
52 }
53 </style>
54 </head>
55 <body>
56 <h1><xsl:value-of select="/fll:challenge/@name"/></h1>
57 <xsl:apply-templates />
58 </body>
59 </html>
60 </xsl:template>
61
62 <xsl:template match="strings">
63 </xsl:template>
64
65 <xsl:template match="mission">
66 <xsl:variable name="key" select="@name"/>
67 <div class="mission">
68 <h2>
69 <xsl:value-of select="/fll:challenge/strings/string[@id=$key]"/>
70 </h2>
71 <xsl:apply-templates />
72 </div>
73 </xsl:template>
74
75 <xsl:template match="objective-enum">
76 <xsl:variable name="key" select="@description"/>
77 <div class="objective">
78 <span class="desc">
79 <xsl:value-of select="/fll:challenge/strings/string[@id=$key]"/>
80 </span>
81 <span class="values">
82 <xsl:for-each select="option">
83 <xsl:variable name="key2" select="@description"/>
84 <span><xsl:value-of select="/fll:challenge/strings/string[@id=$key2]"/></span>
85 </xsl:for-each>
86 </span>
87 </div>
88 </xsl:template>
89
90 <xsl:template match="objective-number">
91 <xsl:variable name="key" select="@description"/>
92 <div class="objective">
93 <span class="desc">
94 <xsl:value-of select="/fll:challenge/strings/string[@id=$key]"/>
95 </span>
96 <span class="values">
97 <xsl:call-template name="numbers">
98 <xsl:with-param name="min" select="@min"/>
99 <xsl:with-param name="max" select="@max"/>
100 </xsl:call-template>
101 </span>
102 </div>
103 </xsl:template>
104
105 <xsl:template match="objective-yesno">
106 <xsl:variable name="key" select="@description"/>
107 <div class="objective">
108 <span class="desc">
109 <xsl:value-of select="/fll:challenge/strings/string[@id=$key]"/>
110 </span>
111 <span class="values">
112 <span>Yes</span>
113 <span>No</span>
114 </span>
115 </div>
116 </xsl:template>
117
118 <xsl:template name="numbers">
119 <xsl:param name="min" />
120 <xsl:param name="max" />
121 <xsl:if test="$min &lt;= $max">
122 <span>
123 <xsl:value-of select="$min"/>
124 </span>
125
126 <xsl:call-template name="numbers">
127 <xsl:with-param name="min" select="$min+1"/>
128 <xsl:with-param name="max" select="$max"/>
129 </xsl:call-template>
130 </xsl:if>
131 </xsl:template>
132
133</xsl:stylesheet>