comparison xsl/unitcard.xsl @ 402:cf8fc32e020a xsl-output

preliminary xsl output
author Dan.Kulinski@dank-laptop.Global.Local
date Thu, 18 Aug 2011 11:14:14 -0600
parents
children a33be6e995c9
comparison
equal deleted inserted replaced
401:3a71f8af5bde 402:cf8fc32e020a
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>
12 div#armyInfo { font-size: x-large; width: 100%; margin-bottom: 2em; }
13 div.unitcard { border: 1px solid black; width: 50%; margin-bottom: 2em; }
14 div.unitcard table { width: 100%; }
15 div.unitcard table th { background-color: #999999; }
16 table.stats { border-collapse: collapse; }
17 table.stats tr { border-top: 1px solid black; border-bottom: 1px solid black; }
18 table.stats td { border-right: 1px solid black; }
19 h3 { font-size: small; font-variant: small-caps; }
20 list.equipmentList { font-size: small; }
21 list.abilityList { font-size: small; }
22 </style>
23 </head>
24 <body>
25 <div id="armyInfo">
26 Name: <xsl:value-of select="/army/name"/> <br />
27 Points: <xsl:value-of select="/army/pointsUsed"/> of
28 <xsl:value-of select="/army/pointsAvailable"/>
29 </div>
30 <xsl:for-each select="/army/category">
31 <xsl:for-each select="./unit">
32 <div class="unitcard">
33 <table>
34 <th align="left" width="50%">
35 <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
36 </th>
37 <th width="25%">
38 Models: <xsl:value-of select="sum(.//@models)"/>
39 </th>
40 <th width="25%">
41 Points: <xsl:value-of select="./@points"/>
42 </th>
43 </table>
44 <table class="stats">
45 <xsl:for-each select="./statLine[1]">
46 <tr>
47 <xsl:for-each select="./stat">
48 <td>
49 <b>
50 <xsl:value-of select="translate(./@name,$lower,$upper)"/>
51 </b>
52 </td>
53 </xsl:for-each>
54 </tr>
55 </xsl:for-each>
56 <xsl:for-each select="./statLine">
57 <tr>
58 <xsl:for-each select="./stat">
59 <td>
60 <xsl:value-of select="./@value"/>
61 </td>
62 </xsl:for-each>
63 </tr>
64 </xsl:for-each>
65 </table>
66 <h3>Equipment</h3>
67 <p>
68 <list class="equipmentList">
69 <xsl:for-each select="./equipmentItem">
70 <li>
71 <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
72 </li>
73 </xsl:for-each>
74 </list>
75 </p>
76 </div>
77 </xsl:for-each>
78 </xsl:for-each>
79 <h3>Special Rules</h3>
80 <list class="abilityList">
81 <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
82 <li>
83 <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
84 </li>
85 </xsl:for-each>
86 </list>
87 </body>
88 </html>
89 </xsl:template>
90 </xsl:stylesheet>