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