Mercurial > repos > IBDev-IBBoard.WarFoundry.API
comparison xsl/unitcard.xsl @ 408:dee3dcb72acf
Re #355: Add XML export format that can be transformed with an XSL
* Merge Clutch's XML/XSL API changes
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 25 Aug 2011 21:05:49 +0100 |
parents | a33be6e995c9 |
children |
comparison
equal
deleted
inserted
replaced
394:cbe69734f48f | 408:dee3dcb72acf |
---|---|
1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
2 <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" method="html" indent="yes" omit-xml-declaration="yes"/> | |
3 <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable> | |
4 <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable> | |
5 <xsl:template match="/"> | |
6 <html> | |
7 <head> | |
8 <title> | |
9 <xsl:value-of select="/army/name"/> - Created in WarFoundry | |
10 </title> | |
11 <style media="all"> | |
12 div#armyInfo { font-size: x-large; width: 100%; margin-bottom: 2em; } | |
13 div.unitcard { border: 1px solid black; width: 75%; margin-bottom: 2em; } | |
14 div.unitcard table.title { width: 100%; } | |
15 div.unitcard table.title th { background-color: #999999; } | |
16 table.stats { border-collapse: collapse; width: 100%;} | |
17 table.lists { padding: 0px; margins: 0px; border: 1px solid black; width: 100%} | |
18 table.lists th { font-size: small; font-variant: small-caps; text-align: left; } | |
19 table.lists td { width: 45%; } | |
20 ul.equipmentList { font-size: small; display: inline; list-style-type: none; } | |
21 ul.abilityList { font-size: small; display: inline; list-style-type: none; } | |
22 </style> | |
23 <style media="print"> | |
24 div.unitcard { page-break-inside: avoid; } | |
25 div.specialrules { page-break-inside: avoid; } | |
26 div.pagebreak { page-break-after: always; display: none; } | |
27 </style> | |
28 </head> | |
29 <body> | |
30 <div id="armyInfo"> | |
31 Name: <xsl:value-of select="/army/name"/> <br /> | |
32 Points: <xsl:value-of select="/army/pointsUsed"/> of | |
33 <xsl:value-of select="/army/pointsAvailable"/> | |
34 </div> | |
35 <xsl:for-each select="/army/category"> | |
36 <xsl:for-each select="./unit"> | |
37 <div class="unitcard"> | |
38 <table class="title"> | |
39 <th align="left" width="50%"> | |
40 <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/> | |
41 </th> | |
42 <th width="25%"> | |
43 Models: <xsl:value-of select="sum(.//@models)"/> | |
44 </th> | |
45 <th width="25%"> | |
46 Points: <xsl:value-of select="./@points"/> | |
47 </th> | |
48 </table> | |
49 <table class="stats" border="1"> | |
50 <xsl:for-each select="./statLine[1]"> | |
51 <tr> | |
52 <xsl:for-each select="./stat"> | |
53 <td> | |
54 <b> | |
55 <xsl:value-of select="translate(./@name,$lower,$upper)"/> | |
56 </b> | |
57 </td> | |
58 </xsl:for-each> | |
59 </tr> | |
60 </xsl:for-each> | |
61 <xsl:for-each select="./statLine"> | |
62 <tr> | |
63 <xsl:for-each select="./stat"> | |
64 <td> | |
65 <xsl:value-of select="./@value"/> | |
66 </td> | |
67 </xsl:for-each> | |
68 </tr> | |
69 </xsl:for-each> | |
70 </table> | |
71 <table class="lists"> | |
72 <tr> | |
73 <th> | |
74 Equipment | |
75 </th> | |
76 <th> | |
77 Abilities | |
78 </th> | |
79 </tr> | |
80 <tr> | |
81 <td> | |
82 <ul class="equipmentList"> | |
83 <xsl:for-each select="./equipmentItem"> | |
84 <li> | |
85 <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>) | |
86 </li> | |
87 </xsl:for-each> | |
88 </ul> | |
89 </td> | |
90 <td> | |
91 <ul class="abilityList"> | |
92 <xsl:for-each select="./abilityItem"> | |
93 <li> | |
94 <xsl:value-of select="./@name"/> | |
95 </li> | |
96 </xsl:for-each> | |
97 </ul> | |
98 </td> | |
99 </tr> | |
100 </table> | |
101 </div> | |
102 </xsl:for-each> | |
103 </xsl:for-each> | |
104 <div class="pagebreak"></div> | |
105 <div class="specialrules"> | |
106 <h2>Special Rules</h2> | |
107 <ul class="abilityDescriptions"> | |
108 <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'> | |
109 <li> | |
110 <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/> | |
111 </li> | |
112 </xsl:for-each> | |
113 </ul> | |
114 </div> | |
115 </body> | |
116 </html> | |
117 </xsl:template> | |
118 </xsl:stylesheet> |