Advertisement
legacyking

PCGen Ranges Update

Sep 29th, 2012
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 13.16 KB | None | 0 0
  1.     <!--
  2. ====================================
  3. ====================================
  4.     TEMPLATE - weapons ranged
  5. ====================================
  6. ====================================-->
  7.     <xsl:template match="ranges">
  8.         <xsl:param name="column_width" select="0.55 * $pagePrintableWidth - 2"/>
  9.         <fo:table table-layout="fixed" keep-with-next="always" keep-together="always">
  10.             <fo:table-column column-width="5mm"/>
  11.             <fo:table-column>
  12.                 <xsl:attribute name="column-width"><xsl:value-of select="0.2 * ($column_width - 5)" />mm</xsl:attribute>
  13.             </fo:table-column>
  14.             <fo:table-column>
  15.                 <xsl:attribute name="column-width"><xsl:value-of select="0.2 * ($column_width - 5)" />mm</xsl:attribute>
  16.             </fo:table-column>
  17.             <fo:table-column>
  18.                 <xsl:attribute name="column-width"><xsl:value-of select="0.2 * ($column_width - 5)" />mm</xsl:attribute>
  19.             </fo:table-column>
  20.             <fo:table-column>
  21.                 <xsl:attribute name="column-width"><xsl:value-of select="0.2 * ($column_width - 5)" />mm</xsl:attribute>
  22.             </fo:table-column>
  23.             <fo:table-column>
  24.                 <xsl:attribute name="column-width"><xsl:value-of select="0.2 * ($column_width - 5)" />mm</xsl:attribute>
  25.             </fo:table-column>
  26.             <fo:table-body>
  27.                 <xsl:if test="./ammunition">
  28.                     <fo:table-row keep-with-next.within-column="always">
  29.                         <fo:table-cell number-columns-spanned="6">
  30.                             <xsl:call-template name="attrib">
  31.                                 <xsl:with-param name="attribute" select="'weapon.title'"/>
  32.                             </xsl:call-template>
  33.                             <fo:block font-size="5pt" font-weight="bold">Ammunition: <xsl:value-of select="ammunition/name"/>
  34.                                 <xsl:if test="string(./ammunition/special_properties) != ''">
  35.                                     (<xsl:value-of select="./ammunition/special_properties"/>)
  36.                                 </xsl:if>
  37.                             </fo:block>
  38.                         </fo:table-cell>
  39.                     </fo:table-row>
  40.                 </xsl:if>
  41.                 <xsl:choose>
  42.                 <xsl:when test="range[position()=6 and distance='']">
  43.                 </xsl:when>
  44.                 <xsl:when test="range[position()=11 and distance='']">
  45.                 </xsl:when>
  46.                 <xsl:otherwise>
  47.     <!-->           <xsl:if test="range[position() &gt; 5]">    -->
  48.     <!-->       <xsl:if test="range[position() &gt; 5 or ../../common/range &gt; 10]">  -->
  49.     <!-->           <xsl:if test="count(./ranges/range) = 6 or count(./ranges/range) = 11">-->
  50.                     <fo:table-row keep-with-next.within-column="always">
  51.                         <xsl:for-each select="range[position() &lt; 2]">   
  52.                             <fo:table-cell number-columns-spanned="2">
  53.                             <xsl:call-template name="attrib">
  54.                                 <xsl:with-param name="attribute" select="'weapon.title'"/>
  55.                             </xsl:call-template>
  56.                             <fo:block font-size="7pt" font-weight="bold">
  57.                             Range: <xsl:value-of select="distance"/>
  58.                             </fo:block>
  59.                             </fo:table-cell>
  60.                             <fo:table-cell number-columns-spanned="2">
  61.                             <xsl:call-template name="attrib">
  62.                                 <xsl:with-param name="attribute" select="'weapon.title'"/>
  63.                             </xsl:call-template>
  64.                             <fo:block font-size="7pt" font-weight="bold">
  65.                             To Hit: <xsl:value-of select="to_hit"/>
  66.                             </fo:block>
  67.                             </fo:table-cell>
  68.                             <fo:table-cell number-columns-spanned="2">
  69.                             <xsl:call-template name="attrib">
  70.                                 <xsl:with-param name="attribute" select="'weapon.title'"/>
  71.                             </xsl:call-template>
  72.                             <fo:block font-size="7pt" font-weight="bold">
  73.                             Damage: <xsl:value-of select="damage"/>
  74.                             </fo:block>
  75.                             </fo:table-cell>
  76.                         </xsl:for-each>
  77.                     </fo:table-row>
  78.             <!-->   </xsl:if>   -->
  79.                 </xsl:otherwise>
  80.                 </xsl:choose>
  81.  
  82.  
  83.             <xsl:if test="range[position() &gt; 6]">
  84.                 <fo:table-row keep-with-next.within-column="always">
  85.                     <!-- Distances -->
  86.                     <fo:table-cell>
  87.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  88.                     </fo:table-cell>
  89.                     <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  90.                         <fo:table-cell>
  91.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  92.                             <fo:block font-size="5pt" font-weight="bold">
  93.                                 <xsl:value-of select="distance"/>
  94.                             </fo:block>
  95.                         </fo:table-cell>
  96.                     </xsl:for-each>
  97.                 </fo:table-row>
  98.                 <fo:table-row keep-with-next.within-column="always">
  99.                     <!-- Range To-Hits -->
  100.                     <fo:table-cell>
  101.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  102.                         <fo:block font-size="6pt" font-weight="bold">TH</fo:block>
  103.                     </fo:table-cell>
  104.                     <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  105.                         <fo:table-cell>
  106.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  107.                             <fo:block space-before="1pt">
  108.                                 <xsl:attribute name="font-size">
  109.                                     <xsl:choose>
  110.                                         <xsl:when test="string-length(to_hit) &gt; 15">6pt</xsl:when>
  111.                                         <xsl:otherwise>7pt</xsl:otherwise>
  112.                                     </xsl:choose>
  113.                                 </xsl:attribute>
  114.                                 <xsl:value-of select="to_hit"/>
  115.                             </fo:block>
  116.                         </fo:table-cell>
  117.                     </xsl:for-each>
  118.                 </fo:table-row>
  119.                 <fo:table-row keep-with-next.within-column="always">
  120.                     <!-- Damages -->
  121.                     <fo:table-cell>
  122.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  123.                         <fo:block font-size="6pt" font-weight="bold">Dam</fo:block>
  124.                     </fo:table-cell>
  125.                     <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  126.                         <fo:table-cell>
  127.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  128.                             <fo:block font-size="7pt" space-before="1pt">
  129.                                 <xsl:value-of select="damage"/>
  130.                             </fo:block>
  131.                         </fo:table-cell>
  132.                     </xsl:for-each>
  133.                 </fo:table-row>
  134.                 </xsl:if>
  135. <!-- For Thrown Weapons -->
  136.                
  137.            
  138. <!-- New Row For Actual Range with 10 increments
  139.         CHOOSE tests for Thrown or Ranged and then grants the -->
  140.             <xsl:choose>
  141.             <xsl:when test="range[position() &gt; 6]">
  142.                 <fo:table-row keep-with-next.within-column="always">
  143.                     <!-- Distances -->
  144.                     <fo:table-cell>
  145.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  146.                     </fo:table-cell>
  147.                     <xsl:for-each select="range[position() &gt; 6 and position() &lt; 12]">
  148.                         <fo:table-cell>
  149.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  150.                             <fo:block font-size="5pt" font-weight="bold">
  151.                                 <xsl:value-of select="distance"/>
  152.                             </fo:block>
  153.                         </fo:table-cell>
  154.                     </xsl:for-each>
  155.                 </fo:table-row>
  156.                 <fo:table-row keep-with-next.within-column="always">
  157.                     <!-- Range To-Hits -->
  158.                     <fo:table-cell>
  159.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  160.                         <fo:block font-size="6pt" font-weight="bold">TH</fo:block>
  161.                     </fo:table-cell>
  162.                     <xsl:for-each select="range[position() &gt; 6 and position() &lt; 12]">
  163.                         <fo:table-cell>
  164.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  165.                             <fo:block space-before="1pt">
  166.                                 <xsl:attribute name="font-size">
  167.                                     <xsl:choose>
  168.                                         <xsl:when test="string-length(to_hit) &gt; 15">6pt</xsl:when>
  169.                                         <xsl:otherwise>7pt</xsl:otherwise>
  170.                                     </xsl:choose>
  171.                                 </xsl:attribute>
  172.                                 <xsl:value-of select="to_hit"/>
  173.                             </fo:block>
  174.                         </fo:table-cell>
  175.                     </xsl:for-each>
  176.                 </fo:table-row>
  177.                 <fo:table-row keep-with-next.within-column="always">
  178.                     <!-- Damages -->
  179.                     <fo:table-cell>
  180.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  181.                         <fo:block font-size="6pt" font-weight="bold">Dam</fo:block>
  182.                     </fo:table-cell>
  183.                     <xsl:for-each select="range[position() &gt; 6 and position() &lt; 12]">
  184.                         <fo:table-cell>
  185.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  186.                             <fo:block font-size="7pt" space-before="1pt">
  187.                                 <xsl:value-of select="damage"/>
  188.                             </fo:block>
  189.                         </fo:table-cell>
  190.                     </xsl:for-each>
  191.                 </fo:table-row>
  192.  
  193.  
  194.             </xsl:when>
  195.             <xsl:when test="range[position()=6 and distance='']">
  196.  
  197. <!-->           <xsl:when test="contains(rangetype, 'Thrown')"> -->
  198.                 <fo:table-row keep-with-next.within-column="always">
  199.                     <!-- Distances -->
  200.                     <fo:table-cell>
  201.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  202.                     </fo:table-cell>
  203.                     <xsl:for-each select="range[position() &lt; 6]">   
  204.                         <fo:table-cell>
  205.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  206.                             <fo:block font-size="5pt" font-weight="bold">
  207.                                 <xsl:value-of select="distance"/>
  208.                             </fo:block>
  209.                         </fo:table-cell>
  210.                     </xsl:for-each>
  211.                 </fo:table-row>
  212.                 <fo:table-row keep-with-next.within-column="always">
  213.                     <!-- Range To-Hits -->
  214.                     <fo:table-cell>
  215.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  216.                         <fo:block font-size="6pt" font-weight="bold">TH</fo:block>
  217.                     </fo:table-cell>
  218.                     <xsl:for-each select="range[position() &lt; 6]">   
  219.                         <fo:table-cell>
  220.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  221.                             <fo:block space-before="1pt">
  222.                                 <xsl:attribute name="font-size">
  223.                                     <xsl:choose>
  224.                                         <xsl:when test="string-length(to_hit) &gt; 15">6pt</xsl:when>
  225.                                         <xsl:otherwise>7pt</xsl:otherwise>
  226.                                     </xsl:choose>
  227.                                 </xsl:attribute>
  228.                                 <xsl:value-of select="to_hit"/>
  229.                             </fo:block>
  230.                         </fo:table-cell>
  231.                     </xsl:for-each>
  232.                 </fo:table-row>
  233.                 <fo:table-row keep-with-next.within-column="always">
  234.                     <!-- Damages -->
  235.                     <fo:table-cell>
  236.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  237.                         <fo:block font-size="6pt" font-weight="bold">Dam</fo:block>
  238.                     </fo:table-cell>
  239.                     <xsl:for-each select="range[position() &lt; 6]">
  240.                         <fo:table-cell>
  241.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  242.                             <fo:block font-size="7pt" space-before="1pt">
  243.                                 <xsl:value-of select="damage"/>
  244.                             </fo:block>
  245.                         </fo:table-cell>
  246.                     </xsl:for-each>
  247.                 </fo:table-row>
  248.  
  249.             </xsl:when>
  250.  
  251.             <xsl:otherwise>
  252.  
  253.  
  254. <!-->                       <xsl:when test="range[position() &lt; 8]">  -->
  255.                 <fo:table-row keep-with-next.within-column="always">
  256.                     <!-- Distances -->
  257.                     <fo:table-cell>
  258.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  259.                     </fo:table-cell>
  260.  
  261. <!-->                   <xsl:for-each select="range[position() &lt; 6]">    -->
  262.                     <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  263.                         <fo:table-cell>
  264.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  265.                             <fo:block font-size="5pt" font-weight="bold">
  266.                                 <xsl:value-of select="distance"/>
  267.                             </fo:block>
  268.                         </fo:table-cell>
  269.                     </xsl:for-each>
  270.                 </fo:table-row>
  271.                 <fo:table-row keep-with-next.within-column="always">
  272.                     <!-- Range To-Hits -->
  273.                     <fo:table-cell>
  274.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  275.                         <fo:block font-size="6pt" font-weight="bold">TH</fo:block>
  276.                     </fo:table-cell>
  277.     <!-->               <xsl:for-each select="range[position() &lt; 6]">    -->
  278.                         <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  279.                         <fo:table-cell>
  280.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  281.                             <fo:block space-before="1pt">
  282.                                 <xsl:attribute name="font-size">
  283.                                     <xsl:choose>
  284.                                         <xsl:when test="string-length(to_hit) &gt; 15">6pt</xsl:when>
  285.                                         <xsl:otherwise>7pt</xsl:otherwise>
  286.                                     </xsl:choose>
  287.                                 </xsl:attribute>
  288.                                 <xsl:value-of select="to_hit"/>
  289.                             </fo:block>
  290.                         </fo:table-cell>
  291.                     </xsl:for-each>
  292.                 </fo:table-row>
  293.                 <fo:table-row keep-with-next.within-column="always">
  294.                     <!-- Damages -->
  295.                     <fo:table-cell>
  296.                         <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.title'"/></xsl:call-template>
  297.                         <fo:block font-size="6pt" font-weight="bold">Dam</fo:block>
  298.                     </fo:table-cell>
  299.                     <xsl:for-each select="range[position() &gt; 1 and position() &lt; 8]">
  300. <!--                    <xsl:for-each select="range[position() &lt; 6]">    -->
  301.                         <fo:table-cell>
  302.                             <xsl:call-template name="attrib"><xsl:with-param name="attribute" select="'weapon.hilight'"/></xsl:call-template>
  303.                             <fo:block font-size="7pt" space-before="1pt">
  304.                                 <xsl:value-of select="damage"/>
  305.                             </fo:block>
  306.                         </fo:table-cell>
  307.                     </xsl:for-each>
  308.                 </fo:table-row>
  309.             </xsl:otherwise>
  310.         </xsl:choose>
  311.  
  312.             </fo:table-body>
  313.         </fo:table>
  314.     </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement