changeset 406: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 wrap: on
line diff
--- a/xsl/unitcard.xsl	Fri Aug 19 22:11:01 2011 -0600
+++ b/xsl/unitcard.xsl	Sun Aug 21 22:37:08 2011 -0600
@@ -8,40 +8,45 @@
         <title>
           <xsl:value-of select="/army/name"/> - Created in WarFoundry
         </title>
-        <style>
+        <style media="all">
           div#armyInfo { font-size: x-large; width: 100%; margin-bottom: 2em; }
-          div.unitcard { border: 1px solid black; width: 50%; margin-bottom: 2em; }
-          div.unitcard table { width: 100%; }
-          div.unitcard table th { background-color: #999999; }
-          table.stats { border-collapse: collapse; }
-          table.stats tr { border-top: 1px solid black; border-bottom: 1px solid black; }
-          table.stats td { border-right: 1px solid black; }
-          h3 { font-size: small; font-variant: small-caps; }
-          list.equipmentList { font-size: small; }
-          list.abilityList { font-size: small; }
+          div.unitcard { border: 1px solid black; width: 75%; margin-bottom: 2em; }
+          div.unitcard table.title { width: 100%; }
+          div.unitcard table.title th { background-color: #999999; }
+          table.stats { border-collapse: collapse; width: 100%;}
+          table.lists { padding: 0px; margins: 0px; border: 1px solid black; width: 100%}
+          table.lists th { font-size: small; font-variant: small-caps; text-align: left; }
+          table.lists td { width: 45%; }
+          ul.equipmentList { font-size: small; display: inline; list-style-type: none; }
+          ul.abilityList { font-size: small; display: inline; list-style-type: none; }
+        </style>
+        <style media="print">
+          div.unitcard { page-break-inside: avoid; }
+          div.specialrules { page-break-inside: avoid; }
+          div.pagebreak { page-break-after: always; display: none; }
         </style>
       </head>
       <body>
         <div id="armyInfo">
-            Name: <xsl:value-of select="/army/name"/> <br />
-            Points: <xsl:value-of select="/army/pointsUsed"/> of
-            <xsl:value-of select="/army/pointsAvailable"/>
+          Name: <xsl:value-of select="/army/name"/> <br />
+          Points: <xsl:value-of select="/army/pointsUsed"/> of
+          <xsl:value-of select="/army/pointsAvailable"/>
         </div>
         <xsl:for-each select="/army/category">
           <xsl:for-each select="./unit">
-          <div class="unitcard">
-            <table>
-              <th align="left" width="50%">
-                <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
-              </th>
-              <th width="25%">
-                Models: <xsl:value-of select="sum(.//@models)"/>
-              </th>
-              <th width="25%">
-                Points: <xsl:value-of select="./@points"/>
-              </th>
-            </table>
-              <table class="stats">
+            <div class="unitcard">
+              <table class="title">
+                <th align="left" width="50%">
+                  <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
+                </th>
+                <th width="25%">
+                  Models: <xsl:value-of select="sum(.//@models)"/>
+                </th>
+                <th width="25%">
+                  Points: <xsl:value-of select="./@points"/>
+                </th>
+              </table>
+              <table class="stats" border="1">
                 <xsl:for-each select="./statLine[1]">
                   <tr>
                     <xsl:for-each select="./stat">
@@ -63,27 +68,50 @@
                   </tr>
                 </xsl:for-each>
               </table>
-            <h3>Equipment</h3>
-            <p>
-              <list class="equipmentList">
-              <xsl:for-each select="./equipmentItem">
-                <li>
-                  <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
-                </li>
-              </xsl:for-each>
-              </list>
-            </p>
-          </div>
+              <table class="lists">
+                <tr>
+                  <th>
+                    Equipment
+                  </th>
+                  <th>
+                    Abilities
+                  </th>
+                </tr>
+                <tr>
+                  <td>
+                    <ul class="equipmentList">
+                      <xsl:for-each select="./equipmentItem">
+                        <li>
+                          <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
+                        </li>
+                      </xsl:for-each>
+                    </ul>
+                  </td>
+                  <td>
+                    <ul class="abilityList">
+                      <xsl:for-each select="./abilityItem">
+                        <li>
+                          <xsl:value-of select="./@name"/>
+                        </li>
+                      </xsl:for-each>
+                    </ul>
+                  </td>
+                </tr>
+              </table>
+            </div>
+          </xsl:for-each>
+        </xsl:for-each>
+        <div class="pagebreak"></div>
+        <div class="specialrules">
+          <h2>Special Rules</h2>
+          <ul class="abilityDescriptions">
+            <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
+              <li>
+                <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
+              </li>
             </xsl:for-each>
-          </xsl:for-each>
-        <h3>Special Rules</h3>
-        <list class="abilityList">
-        <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
-          <li>
-            <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
-          </li>
-        </xsl:for-each>
-        </list>
+          </ul>
+        </div>
       </body>
     </html>
   </xsl:template>