/ .. / / -> download
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">

<!-- Formatting rulse for fault isolation are contained in Issue 3.0 -->
    
    <xsl:template match="faultIsolation">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="faultReporting">
        <fo:block xsl:use-attribute-sets="centerhead2">
            <xsl:text>Fault reporting - </xsl:text>
            <xsl:choose>
                <xsl:when test="child::isolatedFault">
                    <xsl:text>Isolated </xsl:text>
                </xsl:when>
                <xsl:when test="child::detectedFault">
                    <xsl:text>Detected </xsl:text>
                </xsl:when>
                <xsl:when test="child::observedFault">
                    <xsl:text>Observed </xsl:text>
                </xsl:when>
                <xsl:when test="child::correlatedFault">
                    <xsl:text>Correlated </xsl:text>
                </xsl:when>
            </xsl:choose>
            <xsl:text>fault</xsl:text>
        </fo:block>
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="faultIsolationProcedure">
        <xsl:apply-templates select="*[not(self::faultDescr)]"/>	
    </xsl:template>

    <xsl:template match="isolatedFault | detectedFault | observedFault">

        <xsl:apply-templates select="*[not(descendant-or-self::faultDescr)]"/>	
    </xsl:template>
    
    <xsl:template name="process-faults">
        <xsl:if test="not(descendant::correlatedFault)">
        <fo:block font-size="14pt" font-weight="bold" space-before="13pt"
            space-before.precedence="1" space-after="8pt" keep-with-next="always">
            <xsl:text>Fault codes</xsl:text>
        </fo:block>
        <fo:block>
                 <fo:table width="7.0in" border-bottom="solid" border-bottom-width="0.25pt"
                    border-top="solid" border-top-width="0.25pt" font-size="10pt"
                    margin-bottom="10pt" margin-top="8pt" padding-bottom="3pt" padding-left="3pt"
                    relative-position="static" space-after.maximum="12pt" space-after.minimum="12pt"
                    space-after.optimum="12pt" space-before.maximum="14pt"
                    space-before.minimum="12pt" space-before.optimum="12pt" span="all"
                    table-layout="fixed" table-omit-header-at-break="false" text-align="left"
                    white-space-treatment="preserve">
                     <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
                     <fo:table-column column-number="2" column-width="proportional-column-width(3)"/>
                    <fo:table-header text-align="left" space-before="10pt" space-after="10pt"
                        border-after-style="solid" border-after-width="0.25pt">
                        <fo:table-row>
                            <fo:table-cell
                                xsl:use-attribute-sets="table.cell.padding">
                                <fo:block font-weight="bold">Fault code</fo:block>
                            </fo:table-cell>
                            <fo:table-cell
                                xsl:use-attribute-sets="table.cell.padding">
                                <fo:block font-weight="bold">Fault description</fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                     </fo:table-header>
                    <fo:table-body>
                        <xsl:choose>
                            <xsl:when test="faultIsolation">
                                <fo:table-row>
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><fo:block><xsl:value-of select="faultIsolation/faultIsolationProcedure/fault/@faultCode"/></fo:block></fo:table-cell>                    
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><xsl:apply-templates select="faultIsolation/faultIsolationProcedure/faultDescr"/></fo:table-cell>
                                </fo:table-row>
                            </xsl:when>
                            <xsl:when test="faultReporting/isolatedFault">
                                <fo:table-row>
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><fo:block><xsl:value-of select="faultReporting/isolatedFault/@faultCode"/></fo:block></fo:table-cell>                    
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><xsl:apply-templates select="faultReporting/isolatedFault/faultDescr"/></fo:table-cell>
                                </fo:table-row>
                            </xsl:when>
                            <xsl:when test="faultReporting/detectedFault">
                                <fo:table-row>
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><fo:block><xsl:value-of select="faultReporting/detectedFault/@faultCode"/></fo:block></fo:table-cell>                    
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><xsl:apply-templates select="faultReporting/detectedFault/faultDescr"/></fo:table-cell>
                                </fo:table-row>
                            </xsl:when>
                            <xsl:when test="faultReporting/observedFault">
                                <fo:table-row>
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><fo:block><xsl:value-of select="faultReporting/observedFault/@faultCode"/></fo:block></fo:table-cell>                    
                                    <fo:table-cell xsl:use-attribute-sets="table.cell.padding"><xsl:apply-templates select="faultReporting/observedFault/faultDescr"/></fo:table-cell>
                                </fo:table-row>
                            </xsl:when>
                        </xsl:choose>
                   </fo:table-body>
                </fo:table>
        </fo:block>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="fault">
        <xsl:if test="ancestor::correlatedFault">
            <fo:block start-indent="21mm" keep-together.within-page="always">
                <xsl:text>Fault code: </xsl:text>
                <xsl:value-of select="@faultCode"/>
            </fo:block>
        </xsl:if>
<!-- do nothing -->
    </xsl:template>
    
    <xsl:template match="faultDescr">
        <xsl:choose>
            <xsl:when test="ancestor::correlatedFault">
                <fo:block xsl:use-attribute-sets="sidehead0">
                    <xsl:text>Fault description</xsl:text>
                </fo:block>
                <fo:block start-indent="21mm" keep-together.within-page="always">
                    <xsl:apply-templates/>
                </fo:block>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates/>
            </xsl:otherwise>
        </xsl:choose>
     </xsl:template>
    
    <xsl:template match="descr">
        <fo:block keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>  
    
    <xsl:template match="detailedFaultDescr">
        <fo:block keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="viewLocation">
        <fo:block>
            <xsl:text>View location: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="systemLocation">
        <fo:block>
            <xsl:text>System location: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>

    <xsl:template match="systemName">
        <fo:block>
            <xsl:text>System name: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
 
    <xsl:template match="faultySubSystem">
        <fo:block>
            <xsl:text>Faulty subsystem: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
  
    <xsl:template match="systemIdent">
        <fo:block>
            <xsl:text>System identification: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
 
    <xsl:template match="systemPosition">
        <fo:block>
            <xsl:text>System position: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
 
    <xsl:template match="faultEquip">
        <fo:block>
            <xsl:text>Fault equipment: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
 
    <xsl:template match="faultMessageIndication">
        <fo:block>
            <xsl:text>Fault message indication: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
 
    <xsl:template match="faultMessageBody">
        <fo:block>
            <xsl:text>Fault message body: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
  
    <xsl:template match="faultCond">
        <fo:block>
            <xsl:text>Fault condition: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="isolationProcedure">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="isolationMainProcedure">
        <fo:block xsl:use-attribute-sets="centerhead2">
            <xsl:text>Fault isolation procedure</xsl:text>
        </fo:block>
        <xsl:apply-templates/>
        
    </xsl:template>
    
    <xsl:template match="isolationStep">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="isolationStepAnswer">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="listOfChoices">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="isolationProcedureEnd">
        <xsl:apply-templates/>
        <fo:block start-indent="21mm" space-after="8pt" font-weight="bold">
            <xsl:text>Go to Requirements after job completion.</xsl:text>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="yesNoAnswer">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="detectedLruItem | locateAndRepairLruItem">
            <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="detectionInfo">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Detection information</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" space-after="8pt" keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
   <xsl:template match="lru">
       <fo:block xsl:use-attribute-sets="sidehead1">
           <xsl:text>LRU</xsl:text>
       </fo:block>
       <fo:block start-indent="21mm" keep-together.within-page="always">
       <xsl:if test="../@faultProbability">
           <fo:block>
               <xsl:text>Fault probability: </xsl:text>
               <xsl:value-of select="../@faultProbability"/>
           </fo:block>
       </xsl:if>
       <xsl:if test="name">
            <fo:block>
                <xsl:text>Name: </xsl:text>
                <xsl:apply-templates select="name"/>
            </fo:block>
        </xsl:if>
        <xsl:if test="shortname">
            <fo:block>
                <xsl:text>Shortname: </xsl:text>
                <xsl:apply-templates select="shortName"/>
            </fo:block> 
        </xsl:if>    
       <xsl:if test="catalogSeqNumberRef">
           <fo:block>
               <xsl:text>Catalog sequence number: </xsl:text>
                <xsl:apply-templates select="catalogSeqNumberRef"/>
            </fo:block>
       </xsl:if>    
       <xsl:if test="natoStockNumber">
           <fo:block>
               <xsl:text>NATO stock number: </xsl:text>
            <xsl:apply-templates select="nataStockNumber"/>
            </fo:block>
       </xsl:if>    
       <xsl:if test="identNumber">
           <fo:block>
                <xsl:text>Identification number: </xsl:text>
                    <fo:block start-indent="28mm">
                        <xsl:apply-templates select="identNumber"/>
                    </fo:block>
                </fo:block>
       </xsl:if>    
       <xsl:if test="functionalItemRef">
           <fo:block>
                <xsl:text>Functional item reference: </xsl:text>
                <xsl:apply-templates select="functionalItemRef"/>
            </fo:block>
       </xsl:if>   
       </fo:block>
   </xsl:template>
    
    <xsl:template match="faultReporting/*/remarks">
           <xsl:choose>
               <xsl:when test="preceding-sibling::lru">
                   <fo:block xsl:use-attribute-sets="sidehead2">
                       <xsl:text>Remarks</xsl:text>
                    </fo:block>                       
               </xsl:when>
               <xsl:when test="preceding-sibling::sru">
                   <fo:block xsl:use-attribute-sets="sidehead3">
                       <xsl:text>Remarks</xsl:text>
                   </fo:block>                       
               </xsl:when>
               <xsl:when test="parent::detectedFault | parent::observedFault | parent::correlatedFault">
                   <fo:block xsl:use-attribute-sets="sidehead1">
                       <xsl:text>Remarks</xsl:text>
                   </fo:block>                       
                   
               </xsl:when>
                   
           </xsl:choose>
        <fo:block start-indent="21mm" keep-together.within-page="always">
                <xsl:apply-templates/>
            </fo:block>
    </xsl:template>
    
    <xsl:template match="sru">
        <fo:block xsl:use-attribute-sets="sidehead2">
            <xsl:text>SRU</xsl:text>
        </fo:block>
        <fo:block keep-together.within-page="always">
        <xsl:if test="../@faultProbability">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Fault probability: </xsl:text>
                <xsl:value-of select="../@faultProbability"/>
            </fo:block>
        </xsl:if>
        <xsl:if test="name">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Name: </xsl:text>
                <xsl:apply-templates select="name"/>
            </fo:block>
        </xsl:if>
        <xsl:if test="shortname">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Shortname: </xsl:text>
                <xsl:apply-templates select="shortName"/>
            </fo:block> 
        </xsl:if>    
        <xsl:if test="catalogSeqNumberRef">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Catalog sequence number: </xsl:text>
                <xsl:apply-templates select="catalogSeqNumberRef"/>
            </fo:block>
        </xsl:if>    
        <xsl:if test="natoStockNumber">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>NATO stock number: </xsl:text>
                <xsl:apply-templates select="nataStockNumber"/>
            </fo:block>
        </xsl:if>    
        <xsl:if test="identNumber">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Identification number: </xsl:text>
                <xsl:apply-templates select="identNumber"/>
            </fo:block>
        </xsl:if>    
        <xsl:if test="functionalItemRef">
            <fo:block xsl:use-attribute-sets="sidehead3">
                <xsl:text>Functional item reference: </xsl:text>
                <xsl:apply-templates select="functionalItemRef"/>
            </fo:block>
        </xsl:if>  
        </fo:block>
    </xsl:template>

    <xsl:template match="repair | faultIsolationRef | testDescr | testProcedure">
        <xsl:choose>
            <xsl:when test="refs">
                 <fo:table-and-caption start-indent="0pt">
                     <fo:table-caption>
                         <fo:block font-weight="bold"
                             keep-with-previous.within-column="always"
                             keep-with-previous.within-page="always" space-after.maximum="10pt"
                             space-after.minimum="10pt" space-after.optimum="10pt"
                             space-before.maximum="12pt" space-before.minimum="8pt"
                             space-before.optimum="10pt" span="all" text-align="center">
                             <xsl:text disable-output-escaping="no">Table </xsl:text>
                             <xsl:call-template name="number-tables"/>
                             <xsl:choose>
                                 <xsl:when test="self::repair">
                                     <xsl:text disable-output-escaping="no">  Repair</xsl:text>
                                 </xsl:when>
                                 <xsl:when test="self::faultIsolationRef">
                                     <xsl:text disable-output-escaping="no">  Fault Isolation Reference</xsl:text>
                                 </xsl:when>
                                 <xsl:when test="self::testDescr">
                                     <xsl:text disable-output-escaping="no">  </xsl:text><xsl:value-of select="testName"/>
                                 </xsl:when>
                                 <xsl:when test="self::testProcedure">
                                     <xsl:text disable-output-escaping="no">  Test Procedure</xsl:text>
                                 </xsl:when>
                             </xsl:choose>
                         </fo:block>
                     </fo:table-caption>
                     <xsl:call-template name="refsTable"/>
                 </fo:table-and-caption>
            </xsl:when>
            <xsl:otherwise>
                <fo:block>
                    <xsl:text>Test name: </xsl:text>
                    <xsl:apply-templates select="testName"/>
                </fo:block>
            </xsl:otherwise> 
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="testName">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="isolateDetectedFault">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Isolate detected fault</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" space-after="8pt">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="lruItem">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="faultIsolationTest">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Fault isolation test</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" space-after="8pt">
            <fo:block>
                <xsl:text>Test type: </xsl:text>
                <xsl:value-of select="@testType"/>
            </fo:block>
            <fo:block>
                <xsl:text>Test code: </xsl:text>
                <xsl:value-of select="@testCode"/>
            </fo:block>
            <xsl:apply-templates select="testDescr"/>
            <xsl:if test="testParameters">
                <fo:block xsl:use-attribute-sets="sidehead1">
                    <xsl:text>Test parameters</xsl:text>
                </fo:block>
                <fo:block keep-together.within-page="always">                
                    <xsl:apply-templates select="testParameters"/>
                </fo:block>
            </xsl:if>       
            <xsl:if test="testProcedure">
                    
                    <xsl:apply-templates select="testProcedure"/>
            </xsl:if>       
        </fo:block>            
    </xsl:template>
    
    <xsl:template match="testParameters">
        <fo:block start-indent="28mm" space-after="8pt">
            <xsl:if test="@from">
                <fo:block>
                <xsl:text>From: </xsl:text>
                <xsl:value-of select="@from"/>                  
                </fo:block>
            </xsl:if>
            <xsl:if test="@to">
                <fo:block>
                <xsl:text>To: </xsl:text>
                <xsl:value-of select="@to"/>              
                </fo:block>
            </xsl:if>
            <xsl:if test="@unitOfMeasure">
                <fo:block>
                <xsl:text>Unit of measure: </xsl:text>
                <xsl:value-of select="@unitOfMeasure"/>       
                </fo:block>
            </xsl:if>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="sruItem">
        <xsl:apply-templates/>
    </xsl:template>  
    
    <xsl:template match="sru">
        <fo:block xsl:use-attribute-sets="sidehead1">
            <xsl:text>SRU</xsl:text>
        </fo:block>
        <fo:block>
            <xsl:text>Fault probability: </xsl:text>
            <xsl:value-of select="@faultProbability"/>
        </fo:block>
        <xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="locateAndRepair">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Locate and repair</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm">
            <xsl:apply-templates/>  
        </fo:block>
    </xsl:template>
   
    <xsl:template match="contextAndIsolationInfo">
       <xsl:apply-templates/>
    </xsl:template>
   
    <xsl:template match="faultContext">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Fault context</xsl:text>
        </fo:block>  
        <fo:block start-indent="21mm">
            <xsl:apply-templates/>
        </fo:block>        
    </xsl:template>
    
    <xsl:template match="isolationInfo">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Isolation information</xsl:text>
        </fo:block>  
        <fo:block start-indent="21mm">
            <xsl:apply-templates/>
        </fo:block>        
    </xsl:template>

    <xsl:template match="diagnosticProcess">
        <fo:block xsl:use-attribute-sets="sidehead0">
            <xsl:text>Diagnostic process</xsl:text>
        </fo:block>  
        <fo:block start-indent="21mm">
            <xsl:apply-templates/>
        </fo:block>        
    </xsl:template>
    
    <xsl:template match="diagnosticsReason">
        <fo:block>
            <xsl:text>Diagnostics reason: </xsl:text>
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="correlatedFault">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="basicCorrelatedFaults">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="warningMalfunction">
        <fo:block xsl:use-attribute-sets="sidehead1">
            <xsl:text>Warning malfunction</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="associatedWarningMalfunction">
        <fo:block xsl:use-attribute-sets="sidehead1">
            <xsl:text>Associated warning malfunction</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
    <xsl:template match="bitMessage">
        <fo:block xsl:use-attribute-sets="sidehead1">
            <xsl:text>Bit message</xsl:text>
        </fo:block>
        <fo:block start-indent="21mm" keep-together.within-page="always">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>
    
</xsl:stylesheet>


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