changeset 407:a33be6e995c9 xsl-output

Finalized the layout and HTML elements.
author Dan@Prey
date Sun, 21 Aug 2011 22:37:08 -0600
parents a83846cce1f9
children 2c52f0235774
files xsl/unitcard.xsl
diffstat 1 files changed, 74 insertions(+), 46 deletions(-) [+]
line diff
     1.1 --- a/xsl/unitcard.xsl	Fri Aug 19 22:11:01 2011 -0600
     1.2 +++ b/xsl/unitcard.xsl	Sun Aug 21 22:37:08 2011 -0600
     1.3 @@ -8,40 +8,45 @@
     1.4          <title>
     1.5            <xsl:value-of select="/army/name"/> - Created in WarFoundry
     1.6          </title>
     1.7 -        <style>
     1.8 +        <style media="all">
     1.9            div#armyInfo { font-size: x-large; width: 100%; margin-bottom: 2em; }
    1.10 -          div.unitcard { border: 1px solid black; width: 50%; margin-bottom: 2em; }
    1.11 -          div.unitcard table { width: 100%; }
    1.12 -          div.unitcard table th { background-color: #999999; }
    1.13 -          table.stats { border-collapse: collapse; }
    1.14 -          table.stats tr { border-top: 1px solid black; border-bottom: 1px solid black; }
    1.15 -          table.stats td { border-right: 1px solid black; }
    1.16 -          h3 { font-size: small; font-variant: small-caps; }
    1.17 -          list.equipmentList { font-size: small; }
    1.18 -          list.abilityList { font-size: small; }
    1.19 +          div.unitcard { border: 1px solid black; width: 75%; margin-bottom: 2em; }
    1.20 +          div.unitcard table.title { width: 100%; }
    1.21 +          div.unitcard table.title th { background-color: #999999; }
    1.22 +          table.stats { border-collapse: collapse; width: 100%;}
    1.23 +          table.lists { padding: 0px; margins: 0px; border: 1px solid black; width: 100%}
    1.24 +          table.lists th { font-size: small; font-variant: small-caps; text-align: left; }
    1.25 +          table.lists td { width: 45%; }
    1.26 +          ul.equipmentList { font-size: small; display: inline; list-style-type: none; }
    1.27 +          ul.abilityList { font-size: small; display: inline; list-style-type: none; }
    1.28 +        </style>
    1.29 +        <style media="print">
    1.30 +          div.unitcard { page-break-inside: avoid; }
    1.31 +          div.specialrules { page-break-inside: avoid; }
    1.32 +          div.pagebreak { page-break-after: always; display: none; }
    1.33          </style>
    1.34        </head>
    1.35        <body>
    1.36          <div id="armyInfo">
    1.37 -            Name: <xsl:value-of select="/army/name"/> <br />
    1.38 -            Points: <xsl:value-of select="/army/pointsUsed"/> of
    1.39 -            <xsl:value-of select="/army/pointsAvailable"/>
    1.40 +          Name: <xsl:value-of select="/army/name"/> <br />
    1.41 +          Points: <xsl:value-of select="/army/pointsUsed"/> of
    1.42 +          <xsl:value-of select="/army/pointsAvailable"/>
    1.43          </div>
    1.44          <xsl:for-each select="/army/category">
    1.45            <xsl:for-each select="./unit">
    1.46 -          <div class="unitcard">
    1.47 -            <table>
    1.48 -              <th align="left" width="50%">
    1.49 -                <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
    1.50 -              </th>
    1.51 -              <th width="25%">
    1.52 -                Models: <xsl:value-of select="sum(.//@models)"/>
    1.53 -              </th>
    1.54 -              <th width="25%">
    1.55 -                Points: <xsl:value-of select="./@points"/>
    1.56 -              </th>
    1.57 -            </table>
    1.58 -              <table class="stats">
    1.59 +            <div class="unitcard">
    1.60 +              <table class="title">
    1.61 +                <th align="left" width="50%">
    1.62 +                  <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
    1.63 +                </th>
    1.64 +                <th width="25%">
    1.65 +                  Models: <xsl:value-of select="sum(.//@models)"/>
    1.66 +                </th>
    1.67 +                <th width="25%">
    1.68 +                  Points: <xsl:value-of select="./@points"/>
    1.69 +                </th>
    1.70 +              </table>
    1.71 +              <table class="stats" border="1">
    1.72                  <xsl:for-each select="./statLine[1]">
    1.73                    <tr>
    1.74                      <xsl:for-each select="./stat">
    1.75 @@ -63,27 +68,50 @@
    1.76                    </tr>
    1.77                  </xsl:for-each>
    1.78                </table>
    1.79 -            <h3>Equipment</h3>
    1.80 -            <p>
    1.81 -              <list class="equipmentList">
    1.82 -              <xsl:for-each select="./equipmentItem">
    1.83 -                <li>
    1.84 -                  <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
    1.85 -                </li>
    1.86 -              </xsl:for-each>
    1.87 -              </list>
    1.88 -            </p>
    1.89 -          </div>
    1.90 +              <table class="lists">
    1.91 +                <tr>
    1.92 +                  <th>
    1.93 +                    Equipment
    1.94 +                  </th>
    1.95 +                  <th>
    1.96 +                    Abilities
    1.97 +                  </th>
    1.98 +                </tr>
    1.99 +                <tr>
   1.100 +                  <td>
   1.101 +                    <ul class="equipmentList">
   1.102 +                      <xsl:for-each select="./equipmentItem">
   1.103 +                        <li>
   1.104 +                          <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
   1.105 +                        </li>
   1.106 +                      </xsl:for-each>
   1.107 +                    </ul>
   1.108 +                  </td>
   1.109 +                  <td>
   1.110 +                    <ul class="abilityList">
   1.111 +                      <xsl:for-each select="./abilityItem">
   1.112 +                        <li>
   1.113 +                          <xsl:value-of select="./@name"/>
   1.114 +                        </li>
   1.115 +                      </xsl:for-each>
   1.116 +                    </ul>
   1.117 +                  </td>
   1.118 +                </tr>
   1.119 +              </table>
   1.120 +            </div>
   1.121 +          </xsl:for-each>
   1.122 +        </xsl:for-each>
   1.123 +        <div class="pagebreak"></div>
   1.124 +        <div class="specialrules">
   1.125 +          <h2>Special Rules</h2>
   1.126 +          <ul class="abilityDescriptions">
   1.127 +            <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
   1.128 +              <li>
   1.129 +                <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
   1.130 +              </li>
   1.131              </xsl:for-each>
   1.132 -          </xsl:for-each>
   1.133 -        <h3>Special Rules</h3>
   1.134 -        <list class="abilityList">
   1.135 -        <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
   1.136 -          <li>
   1.137 -            <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
   1.138 -          </li>
   1.139 -        </xsl:for-each>
   1.140 -        </list>
   1.141 +          </ul>
   1.142 +        </div>
   1.143        </body>
   1.144      </html>
   1.145    </xsl:template>