/ .. / / -> download
<?xml version='1.0'?>
<xsl:stylesheet version="1.1"   
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">
    
<!-- 8/30/11 - kr - added code for dm sequence in the page number -->

<!-- From 3031 - Emergency procedure - The checklist pages that contain emergency procedure 
    information/steps shall have heavy black diagonal lines around three edges. 
    However, for operator's alternate checklists, page borders for emergency procedures shall be placed 
    in the left and right margins only, instead of on three sides of the page.	
    S1000D Chapter 6.2.1 paragraph 2.1.
-->
    
    <!-- Code to suppor this requirement is TBD -->
    
<!-- From 3031 - In-work - When a data module in the stage of "in-work" is presented as a paper copy or 
    PDF file, the planned issue number and the time of printing shall be included on each page.	
    S1000D Chapter 6.2.1 paragraph 2.2.
-->
    
    <!-- Code to support this requirement is TBD -->
    
<!-- From 3031- Organization responsible for printing - The S1000D option for printing the identity of 
    the organization responsible for producing the page-oriented output on each page shall not be 
    allowed. (JS)	S1000D Chapter 6.2.1 paragraph 2.3.
    -->



       <!-- From 3031 - Technical manual page sizes shall be selected from the following list:
            a.       Standard page size shall be 11 inches by 8 ½ inches. The usable area shall be 10 inches by 7 1/4 inches (requested change to 7 for 3031A). In addition to standard manuals, the following shall also use the standard page size:
            (1)        Operator's technical manual
            (2)        Alternate operator's Maintenance Test Flight (MTF) manual
            (3)        Alternate operator's checklist
            b.      Double standard page size shall be 17 inches by 11 inches. The usable area shall be 15 3/4 inches by 9 inches.
            c.       Logbook page size shall be 9 ½ inches by 6 ½ inches. The usable area shall be 8 ½ inches by 5 ½ inches.
            d.      Pocket page size shall be 5 ½ inches by 4 inches. The usable area shall be 5 inches by 3 1/8 inches.
            e.       The standard operator's checklist and standard operator's MTF manual page size shall be 4 ½ inches wide by 8 inches in length. Usable area: 3 1/2 x 7 1/2.
       -->      
    
    <!-- Code for pageset satisfying b-e above goes here. -->
    
    <!-- From 3031 -
        a.       Standard page size shall be 11 inches by 8 ½ inches. The usable area shall be 10 inches by 7 1/4 inches (requested change to 7 for 3031A). 
    -->              
   
    <!-- 3031 and S1000D specify 8.5 by 11 -->
    <!-- S1000D specifies 1.5 pica top and bottom margin -->
    <!--S1000D specifies 1 in inside margin -->
    <!-- S1000D specifies .5in outside margin -->
    <xsl:attribute-set name="odd-page-atts">
        <xsl:attribute name="page-height">11in</xsl:attribute>
        <xsl:attribute name="page-width">8.5in</xsl:attribute>
        <xsl:attribute name="margin-top">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-bottom">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-left">1in</xsl:attribute>
        <xsl:attribute name="margin-right">.5in</xsl:attribute>
    </xsl:attribute-set>
    <xsl:attribute-set name="even-page-atts">
        <xsl:attribute name="page-height">11in</xsl:attribute>
        <xsl:attribute name="page-width">8.5in</xsl:attribute>
        <xsl:attribute name="margin-top">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-bottom">1.5pc</xsl:attribute>
        <xsl:attribute name="margin-left">.5in</xsl:attribute>
        <xsl:attribute name="margin-right">1in</xsl:attribute>
    </xsl:attribute-set>   
    
    <!-- S1000D specifies 3.5 pica header and footer -->
    <!-- Added .5 pica to line border -->
    <xsl:attribute-set name="header-atts">
       <xsl:attribute name="extent">17mm</xsl:attribute>
    </xsl:attribute-set>
    <xsl:attribute-set name="footer-atts">
        <xsl:attribute name="extent">17mm</xsl:attribute>
        <xsl:attribute name="display-align">after</xsl:attribute>
    </xsl:attribute-set>
    
    <!-- S1000D specifies 3.5 pica body region top and bottom margins -->
    <!-- Added .5 pica to include the line under the header and before the footer -->
    <xsl:attribute-set name="body-atts">
        <xsl:attribute name="margin-top">4.5pc</xsl:attribute>
        <xsl:attribute name="margin-bottom">4.5pc</xsl:attribute>
    </xsl:attribute-set>

<!-- 8/29/11 - KR - When a DM is part of a PM, the page sequence info needs to be set while processing the PM -->
    <xsl:template match="/" mode="pm">
        <xsl:apply-templates select="dmodule/content" mode="pm"/>
    </xsl:template>
    
    <xsl:template match="/">
        <!-- MIL-STD-3031  - All text (except where fixed font is required) shall be written in Arial font. (JS) -->
       <fo:root font-family="Arial" font-size="10pt">
        <fo:layout-master-set>
           
            <!-- Blank pages:
                Same geometry as odd/even pages,
                but no before region.
            -->
            <!-- From 3031, A blank last page must not be marked. -->
            <fo:simple-page-master master-name="body-page-odd-blank"
                xsl:use-attribute-sets="odd-page-atts">
                <fo:region-body region-name="region-body-blank"/>
                <fo:region-before region-name="region-before-blank"/>          
                <fo:region-after region-name="region-after-blank"/>          
            </fo:simple-page-master>
            <fo:simple-page-master master-name="body-page-even-blank"
                xsl:use-attribute-sets="even-page-atts">
                <fo:region-body region-name="region-body-blank"/>
                <fo:region-before region-name="region-before-blank"/>         
                <fo:region-after region-name="region-after-blank"/>          
            </fo:simple-page-master>
            
            <fo:simple-page-master master-name="body-page-odd"
                xsl:use-attribute-sets="odd-page-atts">
                <fo:region-before region-name="region-before-odd" xsl:use-attribute-sets="header-atts"/>
                <fo:region-after region-name="region-after-odd" xsl:use-attribute-sets="footer-atts"/>
                <fo:region-body  region-name="region-body" xsl:use-attribute-sets="body-atts"/>
            </fo:simple-page-master>
    
            <fo:simple-page-master master-name="body-page-even"
                xsl:use-attribute-sets="even-page-atts">
                <fo:region-before region-name="region-before-even" xsl:use-attribute-sets="header-atts"/>
                <fo:region-after region-name="region-after-even" xsl:use-attribute-sets="footer-atts"/>
                <fo:region-body  region-name="region-body" xsl:use-attribute-sets="body-atts"/>
            </fo:simple-page-master>   
            
            <!-- SIMPLE PAGE MASTER PM Cover
            -->
            <fo:simple-page-master margin-bottom="2pc" margin-left="6pc" margin-right="3pc"
                margin-top="2pc" master-name="pmcoverpg-recto-first" page-height="11in"
                page-width="8.5in">
                
 <!--               <xsl:variable name="AvailSize">                   
                    <xsl:choose>
                        <xsl:when test="//frntcover/notices/avail">26</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>
                    </xsl:variable>-->
                
                <xsl:variable name="SuperSize">                    
                    <xsl:choose>
                        <xsl:when test="restrictionInstructions/supersedure">26</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>

                <xsl:variable name="DistribSize">                  
                    <xsl:choose>
                        <xsl:when test="restrictionInstructions/dataDistribution">35</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                
<!--                <xsl:variable name="ExportSize">                   
                    <xsl:choose>
                        <xsl:when test="//frntcover/notices/export">26</xsl:when>
                        <xsl:when test="//frntcover_abbreviated/notices/export">26</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>-->
                
                <xsl:variable name="DestrSize">                   
                    <xsl:choose>
                        <xsl:when test="restrictionInstructions/dataDestruction">17</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                
                <xsl:variable name="SecurSize">32                   
<!--                    <xsl:choose>
                        <xsl:when test="string-length($docsecr)>0">32</xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>-->
                </xsl:variable>
                
                <xsl:variable name="CoverFooterSize">
                    <!--number($AvailSize)+-->
                    <!--+number($ExportSize)-->
                    <xsl:value-of
                        select="number($SuperSize)+number($DistribSize)+number($DestrSize)+number($SecurSize)+96"/>pt
                </xsl:variable>
                
                <fo:region-body region-name="region-body" margin-top="0pt">                    
                    <xsl:attribute name="margin-bottom">
                        <xsl:value-of select="$CoverFooterSize"/>
                    </xsl:attribute>
                </fo:region-body>
                
                <fo:region-after display-align="after" region-name="pmcoverpg-first-after">                   
                    <xsl:attribute name="extent">
                        <xsl:value-of select="$CoverFooterSize"/>
                    </xsl:attribute>
                </fo:region-after>
            </fo:simple-page-master>
            
            <fo:simple-page-master margin-bottom="2pc" margin-left="6pc" margin-right="3pc"
                margin-top="2pc" master-name="pmcoverpg-recto" page-height="11in"
                page-width="8.5in">               
                <fo:region-body region-name="region-body" margin-bottom="7.5pc" margin-top="8pc"/>
                <fo:region-after extent="7.5pc" region-name="xsl-region-after"/>
            </fo:simple-page-master>
            
            <fo:simple-page-master margin-bottom="2pc" margin-left="3pc" margin-right="6pc"
                margin-top="2pc" master-name="pmcoverpg-verso" page-height="11in"
                page-width="8.5in">                
                <fo:region-body region-name="region-body" margin-bottom="7.5pc" margin-top="8pc"/>
                <fo:region-after extent="7.5pc" region-name="xsl-region-after"/>
            </fo:simple-page-master>
            

<!--  SEQUENCE MASTERS -->
            
         <fo:page-sequence-master master-name="body-pages">
            <fo:repeatable-page-master-alternatives>
              <fo:conditional-page-master-reference
                  master-reference="body-page-odd-blank"
                  odd-or-even="odd"
                  blank-or-not-blank="blank"
                  page-position="any"
              />
              <fo:conditional-page-master-reference
                  master-reference="body-page-even-blank"
                  odd-or-even="even"
                  blank-or-not-blank="blank"
                  page-position="any"
              />
                <fo:conditional-page-master-reference
                  master-reference="body-page-odd"
                  odd-or-even="odd"
                  blank-or-not-blank="not-blank"
                  page-position="any"
              />
              <fo:conditional-page-master-reference
                  master-reference="body-page-even"
                  odd-or-even="even"
                  blank-or-not-blank="not-blank"
                  page-position="any"
              />
            </fo:repeatable-page-master-alternatives>
          </fo:page-sequence-master>
    
    <!--PAGE SEQUENCE MASTER Cover
    -->
            <fo:page-sequence-master master-name="pmcoverpg">
                
                <fo:repeatable-page-master-alternatives>
                    <fo:conditional-page-master-reference master-reference="pmcoverpg-recto-first"
                        odd-or-even="odd" page-position="first" blank-or-not-blank="not-blank"/>
                    <fo:conditional-page-master-reference master-reference="pmcoverpg-recto"
                        odd-or-even="odd" page-position="any" blank-or-not-blank="not-blank"/>
                    <fo:conditional-page-master-reference master-reference="pmcoverpg-verso"
                        odd-or-even="even" page-position="any" blank-or-not-blank="not-blank"/>
                    <fo:conditional-page-master-reference blank-or-not-blank="blank"
                        master-reference="body-page-odd-blank" odd-or-even="odd"/>
                    <fo:conditional-page-master-reference blank-or-not-blank="blank"
                        master-reference="body-page-even-blank" odd-or-even="even"/>
                </fo:repeatable-page-master-alternatives>
            </fo:page-sequence-master>
    
        </fo:layout-master-set>
        <xsl:apply-templates/>
      </fo:root>	        
</xsl:template>
        

</xsl:stylesheet>

/ gopher://khzae.net/0/s1000d/links/projects/3031/sample/PhunGun/CSDB/FO-3031-A00-S1000DGUN-PAGESETS_001-00_EN-US.xsl
Styles: Light Dark Classic