changeset 403:cf8fc32e020a xsl-output

preliminary xsl output
author Dan.Kulinski@dank-laptop.Global.Local
date Thu, 18 Aug 2011 11:14:14 -0600
parents 3a71f8af5bde
children 5d7584a73d7f
files xsl/default_html.xsl xsl/unitcard.xsl
diffstat 2 files changed, 149 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xsl/default_html.xsl	Thu Aug 18 11:14:14 2011 -0600
     1.3 @@ -0,0 +1,59 @@
     1.4 +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     1.5 +  <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"/>
     1.6 +<xsl:template match="/">
     1.7 +  <html>
     1.8 +    <head>
     1.9 +      <style>
    1.10 +        table, th, td { border: 1px solid #000; border-spacing: 0; border-collapse: collapse; margin: 0 }
    1.11 +        table table { width: 100%; border-width: 0; margin: -2px }
    1.12 +        table table td { border-width:0 1px }
    1.13 +      </style>
    1.14 +      <title>
    1.15 +        <xsl:value-of select="/army/name"/>
    1.16 +      </title>
    1.17 +    </head>
    1.18 +    <body>
    1.19 +      <div id="armyInfo">
    1.20 +        <h1>
    1.21 +          <xsl:value-of select="/army/name"/> - <xsl:value-of select="/army/pointsUsed"/>pts
    1.22 +        </h1>
    1.23 +        <xsl:for-each select="/army/category">
    1.24 +          <table>
    1.25 +            <xsl:for-each select="./unit/statLine[1]">
    1.26 +              <tr>
    1.27 +                <xsl:for-each select="./stat">
    1.28 +                  <td>
    1.29 +                    <xsl:value-of select="./@name"/>
    1.30 +                  </td>
    1.31 +                </xsl:for-each>
    1.32 +                <td>Notes</td>
    1.33 +                <td>Points</td>
    1.34 +              </tr>
    1.35 +            </xsl:for-each>
    1.36 +            <xsl:for-each select="./unit/statLine">
    1.37 +              <tr>
    1.38 +                <xsl:for-each select="./stat">
    1.39 +                  <td>
    1.40 +                    <xsl:value-of select="./@value"/>
    1.41 +                  </td>
    1.42 +                </xsl:for-each>
    1.43 +                <td>
    1.44 +                  <xsl:for-each select="../equipmentItem">
    1.45 +                    <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>),
    1.46 +                  </xsl:for-each>
    1.47 +                  <xsl:for-each select="../abilityItem">
    1.48 +                    <xsl:value-of select="./@name"/> (<xsl:value-of select="./@description"/>),
    1.49 +                 </xsl:for-each>
    1.50 +                </td>
    1.51 +                <td>
    1.52 +                  <xsl:value-of select="../@points"/>
    1.53 +                </td>
    1.54 +              </tr>
    1.55 +            </xsl:for-each>
    1.56 +          </table>
    1.57 +        </xsl:for-each>
    1.58 +      </div>
    1.59 +    </body>
    1.60 +  </html>
    1.61 +</xsl:template>
    1.62 +</xsl:stylesheet>
    1.63 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/xsl/unitcard.xsl	Thu Aug 18 11:14:14 2011 -0600
     2.3 @@ -0,0 +1,90 @@
     2.4 +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     2.5 +  <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"/>
     2.6 +  <xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>
     2.7 +  <xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
     2.8 +  <xsl:template match="/">
     2.9 +    <html>
    2.10 +      <head>
    2.11 +        <title>
    2.12 +          <xsl:value-of select="/army/name"/> - Created in WarFoundry
    2.13 +        </title>
    2.14 +        <style>
    2.15 +          div#armyInfo { font-size: x-large; width: 100%; margin-bottom: 2em; }
    2.16 +          div.unitcard { border: 1px solid black; width: 50%; margin-bottom: 2em; }
    2.17 +          div.unitcard table { width: 100%; }
    2.18 +          div.unitcard table th { background-color: #999999; }
    2.19 +          table.stats { border-collapse: collapse; }
    2.20 +          table.stats tr { border-top: 1px solid black; border-bottom: 1px solid black; }
    2.21 +          table.stats td { border-right: 1px solid black; }
    2.22 +          h3 { font-size: small; font-variant: small-caps; }
    2.23 +          list.equipmentList { font-size: small; }
    2.24 +          list.abilityList { font-size: small; }
    2.25 +        </style>
    2.26 +      </head>
    2.27 +      <body>
    2.28 +        <div id="armyInfo">
    2.29 +            Name: <xsl:value-of select="/army/name"/> <br />
    2.30 +            Points: <xsl:value-of select="/army/pointsUsed"/> of
    2.31 +            <xsl:value-of select="/army/pointsAvailable"/>
    2.32 +        </div>
    2.33 +        <xsl:for-each select="/army/category">
    2.34 +          <xsl:for-each select="./unit">
    2.35 +          <div class="unitcard">
    2.36 +            <table>
    2.37 +              <th align="left" width="50%">
    2.38 +                <xsl:value-of select="../@type"/>:<xsl:value-of select="./@name"/>
    2.39 +              </th>
    2.40 +              <th width="25%">
    2.41 +                Models: <xsl:value-of select="sum(.//@models)"/>
    2.42 +              </th>
    2.43 +              <th width="25%">
    2.44 +                Points: <xsl:value-of select="./@points"/>
    2.45 +              </th>
    2.46 +            </table>
    2.47 +              <table class="stats">
    2.48 +                <xsl:for-each select="./statLine[1]">
    2.49 +                  <tr>
    2.50 +                    <xsl:for-each select="./stat">
    2.51 +                      <td>
    2.52 +                        <b>
    2.53 +                          <xsl:value-of select="translate(./@name,$lower,$upper)"/>
    2.54 +                        </b>
    2.55 +                      </td>
    2.56 +                    </xsl:for-each>
    2.57 +                  </tr>
    2.58 +                </xsl:for-each>
    2.59 +                <xsl:for-each select="./statLine">
    2.60 +                  <tr>
    2.61 +                    <xsl:for-each select="./stat">
    2.62 +                      <td>
    2.63 +                        <xsl:value-of select="./@value"/>
    2.64 +                      </td>
    2.65 +                    </xsl:for-each>
    2.66 +                  </tr>
    2.67 +                </xsl:for-each>
    2.68 +              </table>
    2.69 +            <h3>Equipment</h3>
    2.70 +            <p>
    2.71 +              <list class="equipmentList">
    2.72 +              <xsl:for-each select="./equipmentItem">
    2.73 +                <li>
    2.74 +                  <xsl:value-of select="./@name"/> (<xsl:value-of select="./@count"/>)
    2.75 +                </li>
    2.76 +              </xsl:for-each>
    2.77 +              </list>
    2.78 +            </p>
    2.79 +          </div>
    2.80 +            </xsl:for-each>
    2.81 +          </xsl:for-each>
    2.82 +        <h3>Special Rules</h3>
    2.83 +        <list class="abilityList">
    2.84 +        <xsl:for-each select='//abilityItem[not(@name = preceding::abilityItem/@name)]'>
    2.85 +          <li>
    2.86 +            <xsl:value-of select='@name'/> - <xsl:value-of select='@description'/>
    2.87 +          </li>
    2.88 +        </xsl:for-each>
    2.89 +        </list>
    2.90 +      </body>
    2.91 +    </html>
    2.92 +  </xsl:template>
    2.93 +</xsl:stylesheet>
    2.94 \ No newline at end of file