/ .. / / -> download
<?xml version="1.0" encoding="UTF-8"?>
<!--************************************************************************************************************
**		
**		S1000D Issue 4.0/4.0.1 - Stylesheet for US Army page-based TMs 
**		checklist - 
**		
**		The following elements are prohibited by Army and NOT included in this template: 
**		
**		
**		BTAS 12-21-10
**		8/17/11 - KR - commented extraneous code for IC/ICV - 202B
**		8/19/11 - KR - added check for wcn at checklist level	
**      8/29/11 - KW - Corrected error with extraneous equipment not available data
**		
****************************************************************************************************************-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1">
	<xsl:variable name="use-manhour">
		<xsl:choose>
			<xsl:when test="/descendant::taskDuration">
				<xsl:text>yes</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>no</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
		

<!-- MIL-STD-3031: Requirement. 
-->
	<xsl:template match="checkList">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="checkListInfo">
		<xsl:variable name="InfoCodeType">
			<xsl:value-of select="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode"/>
			<xsl:value-of select="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="$InfoCodeType='870B'">
				<fo:block xsl:use-attribute-sets="sidehead0">
					<xsl:text>Checking Unpacked Equipment</xsl:text>
				</fo:block>
				<xsl:call-template name="CheckUnpack"/>
			</xsl:when>
			
			<!--<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='202' AND //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
				<fo:block xsl:use-attribute-sets="sidehead0">
					<xsl:text>I am the queen</xsl:text>
				</fo:block>
			</xsl:when>-->
			
			<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
				<fo:block xsl:use-attribute-sets="sidehead0">
					<xsl:text>Preventive Maintenance Checks and Services</xsl:text>
				</fo:block>
				<xsl:call-template name="PMCS"/>
			</xsl:when>
			<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='D'">
				<fo:block xsl:use-attribute-sets="sidehead0">
					<xsl:text>Preventive maintenance inspection (aircraft only)</xsl:text>
				</fo:block>
				<xsl:call-template name="SpecInspect"/>
			</xsl:when>
			<xsl:otherwise>
				<fo:block color="red">
					<xsl:text>Info code </xsl:text><xsl:value-of select="$InfoCodeType"/><xsl:text> not valid for use with checklist schema.</xsl:text>
				</fo:block>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="CheckUnpack">
		<fo:table wrap-option="wrap" hyphenate="true" xsl:use-attribute-sets="standard.table.setup">
			<fo:table-column column-number="1" column-width="20%"/>
			<fo:table-column column-number="2" column-width="20%"/>
			<fo:table-column column-number="3" column-width="45%"/>
			<fo:table-column column-number="4" column-width="15%"/>
			<fo:table-header>
				<fo:table-row>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="1">
						<fo:block>LOCATION</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="2">
						<fo:block>ITEM</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="3">
						<fo:block>ACTION</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="4">
						<fo:block>REMARKS</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-header>
			<fo:table-body>
				<!-- 8/19/11 - kr - added check for wcn at checklist level -->
				<xsl:if test="child::warning or child::caution or child::note">
					<fo:table-row>
						<fo:table-cell number-columns-spanned="4">
							<xsl:apply-templates select="warning|caution|note"/>
						</fo:table-cell>
					</fo:table-row>
				</xsl:if>
				<!-- 8/19/11 - kr - changed to apply all templates so it won't miss anything
				<xsl:apply-templates select="checkListItems"/>
				--> 
				<xsl:apply-templates select="*[not(self::warning)and not(self::caution) and not(self::note)]"/>
			</fo:table-body>
		</fo:table>
	</xsl:template>	
	
	<xsl:template match="checkListItems">
		<fo:table-row>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="workArea"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:apply-templates select="checkListItem"/>
			</fo:table-cell>
			<xsl:choose>
				<xsl:when test=" descendant::checkListProcedure/checkListPara">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/para"/>
					</fo:table-cell>
					<xsl:choose>
						<xsl:when test="equipmentNotAvailable">
							<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/equipmentNotAvailable"/>
						</xsl:when>
						<xsl:when test="remarks">
							<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/remarks"/>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="descendant::checkListProcedure/checkListStep[1]">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/para"/>
					</fo:table-cell>
					<xsl:choose>
					<!-- 8/29/11 - KW - Limited test to first checkListStep by adding [1] to test and apply templates 
					Old Code:
						<xsl:when test="descendant::checkListProcedure/checkListStep/equipmentNotAvailable">
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/equipmentNotAvailable"/>
							</fo:table-cell>
						</xsl:when>
					-->
						<xsl:when test="descendant::checkListProcedure/checkListStep[1]/equipmentNotAvailable">
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/equipmentNotAvailable"/>
							</fo:table-cell>
						</xsl:when>
						<xsl:when test="child::remarks">
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding" wrap-option="wrap">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/remarks"/>
							</fo:table-cell>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
				</xsl:otherwise>
			</xsl:choose>
		</fo:table-row>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep/checkListStep"/>
		
	</xsl:template>
	
	<xsl:template match="checkListItem">
		<fo:block>
			<xsl:value-of select="./name"/>
		</fo:block>
	</xsl:template>
	
	<xsl:template match="checkListProcedure/checkListStep[1]/checkListStep">
		<fo:table-row>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="1"/>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="2"/>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<!-- 8/17/11 - KR - This codes looks to be extraneous 
					<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='202' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
						<xsl:text>I am the queen</xsl:text>
					</xsl:when>
					-->
					
					<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
						<xsl:choose>
							<xsl:when test="$use-manhour='yes'">
								<xsl:attribute name="column-number">5</xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
								<xsl:attribute name="column-number">4</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="column-number">3</xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:apply-templates select="./para"/>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="./equipmentNotAvailable">
						<xsl:apply-templates select="./equipmentNotAvailable"/>
					</xsl:when>
					<xsl:when test="./remarks">
						<xsl:apply-templates select="./remarks"/>
					</xsl:when>
					<xsl:otherwise>
					</xsl:otherwise>
				</xsl:choose>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>	
	
	<xsl:template match="checkListProcedure/checkListStep[position()!=1]">
		<fo:table-row>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="1"/>
			<!-- 8/29/11 - KW - Added missing not operator (!) to following line to correct error with if test -->
			<xsl:if test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode!='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant!='D'">
				<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="2"/>
			</xsl:if>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
						<xsl:choose>
							<xsl:when test="$use-manhour='yes'">
								<xsl:attribute name="column-number">5</xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
								<xsl:attribute name="column-number">4</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='D'">
						<xsl:attribute name="column-number">2</xsl:attribute>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="column-number">3</xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:apply-templates select="./para"/>
			</fo:table-cell>
			<!-- 8/29/11 - KW - Added missing not operator (!) to following line to correct error with if test -->
			<xsl:if test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode!='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant!='D'">
				<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
					<xsl:choose>
						<xsl:when test="child::equipmentNotAvailable">
							<xsl:apply-templates select="equipmentNotAvailable"/>
						</xsl:when>
						<xsl:when test="child::remarks">
							<xsl:apply-templates select="remarks"/>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</fo:table-cell>
			</xsl:if>			
		</fo:table-row>
	</xsl:template>

	<xsl:template match="checkListStep">
		<fo:table-row>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="1"/>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="2"/>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCode='200' and //dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode/@infoCodeVariant='B'">
						<xsl:choose>
							<xsl:when test="$use-manhour='yes'">
								<xsl:attribute name="column-number">5</xsl:attribute>
							</xsl:when>
							<xsl:otherwise>
								<xsl:attribute name="column-number">4</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="column-number">3</xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:apply-templates select="./para"/>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="descendant::checkListProcedure/checkListStep/equipmentNotAvailable">
						<xsl:apply-templates select="./equipmentNotAvailable"/>
					</xsl:when>
					<xsl:when test="equipmentNotAvailable">
						<xsl:apply-templates select="./equipmentNotAvailable"/>
					</xsl:when>
					<xsl:when test="child::remarks">
						<xsl:apply-templates select="./remarks"/>
					</xsl:when>
					<xsl:otherwise>
					</xsl:otherwise>
				</xsl:choose>
			</fo:table-cell>
		</fo:table-row>
		
	</xsl:template>

	<xsl:template match="equipmentNotAvailable">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="checkListStep/remarks | checkListPara/remarks">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="checkListStep/para">
			<fo:list-block provisional-label-separation="4pt" wrap-option="wrap" provisional-distance-between-starts="14mm">
				<fo:list-item>
					<fo:list-item-label end-indent="label-end()" text-align="start">
						<fo:block>
							<xsl:number count="checkListStep" from="checkListProcedure" format="1" level="multiple"/>
						</fo:block>
					</fo:list-item-label>
					<fo:list-item-body start-indent="body-start()">
						<fo:block>
							<xsl:apply-templates/>
						</fo:block>
					</fo:list-item-body>
				</fo:list-item>
			</fo:list-block>
	</xsl:template>

	<xsl:template name="PMCS">
		<fo:table wrap-option="wrap" hyphenate="true"  xsl:use-attribute-sets="standard.table.setup">
			<xsl:choose>
				<xsl:when test="$use-manhour='yes'">
					<fo:table-column column-number="1" column-width="5%"/>
					<fo:table-column column-number="2" column-width="10%"/>
					<fo:table-column column-number="3" column-width="10%"/>
					<fo:table-column column-number="4" column-width="17o%"/>
					<fo:table-column column-number="5" column-width="40%"/>
					<fo:table-column column-number="6" column-width="18%"/>
				</xsl:when>
				<xsl:otherwise>
					<fo:table-column column-number="1" column-width="7%"/>
					<fo:table-column column-number="2" column-width="17%"/>
					<fo:table-column column-number="3" column-width="15%"/>
					<fo:table-column column-number="4" column-width="43%"/>
					<fo:table-column column-number="5" column-width="18%"/>
				</xsl:otherwise>
			</xsl:choose>
			
			<fo:table-header>
				<fo:table-row>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" wrap-option="wrap" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="1">
						<fo:block>ITEM NO.</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding"  wrap-option="wrap"
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center" column-number="2">
						<fo:block>INTERVAL</fo:block>
					</fo:table-cell>
					<xsl:if test="$use-manhour='yes'">
						<fo:table-cell xsl:use-attribute-sets="table.cell.padding"  wrap-option="wrap"
							border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
							font-size="8pt" font-weight="bold" text-align="center" column-number="3" hyphenation-character="-">
							<fo:block>MAN- HOURS</fo:block>
						</fo:table-cell>
					</xsl:if>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding"  wrap-option="wrap"
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>ITEM TO BE CHECKED OR SERVICED</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding"  wrap-option="wrap"
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>PROCEDURE</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding"  wrap-option="wrap"
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>EQUIPMENT NOT READY/AVAILABLE IF:</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-header>
			<fo:table-body>
				<!-- 8/19/11 - kr - added check for wcn at checklist level -->
				<xsl:if test="child::warning or child::caution or child::note">
					<fo:table-row>
						<xsl:chose>
							<xsl:if test="$use-manhour='yes'">
								<fo:table-cell number-columns-spanned="6">
									<xsl:apply-templates select="warning|caution|note"/>
								</fo:table-cell>
							</xsl:if>
							<xsl:otherwise>
								<fo:table-cell number-columns-spanned="5">
									<xsl:apply-templates select="warning|caution|note"/>
								</fo:table-cell>
							</xsl:otherwise>
						</xsl:chose>
					</fo:table-row>
				</xsl:if>
				<xsl:apply-templates select="checkListItems" mode="PMCS"/>
			</fo:table-body>
		</fo:table>
	</xsl:template>
	
	<xsl:template match="checkListItems" mode="PMCS">
		<xsl:apply-templates select="checkListItem" mode="PMCS"/>
	</xsl:template>
	
	<xsl:template match="checkListItem" mode="PMCS">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="itemNumber"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding" column-number="2">
				<fo:block>
					<xsl:value-of select="threshold/thresholdValue"/>
				</fo:block>
			</fo:table-cell>
			
			<xsl:choose>
				<xsl:when test="$use-manhour='yes'">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<fo:block>
							<xsl:value-of select="taskDuration/@procedureDuration"/>
						</fo:block>
					</fo:table-cell>
				</xsl:when>
			</xsl:choose>
			
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="equip/name | name"/>
				</fo:block>
			</fo:table-cell>
			<xsl:choose>
				<xsl:when test=" descendant::checkListProcedure/checkListPara">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/warning"/>
						<xsl:if test="./checkListProcedure/@crewMemberType">
							<xsl:apply-templates select="@crewMemberType"/>
						</xsl:if>
						<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/para"/>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:choose>
							<xsl:when test="descendant::checkListProcedure/checkListPara/equipmentNotAvailable">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/equipmentNotAvailable"/>
							</xsl:when>
							<xsl:when test="descendant::checkListProcedure/checkListPara/remarks">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/remarks"/>
							</xsl:when>
							<xsl:otherwise>
							</xsl:otherwise>
						</xsl:choose>
					</fo:table-cell>
				</xsl:when>
				<xsl:when test="descendant::checkListProcedure/checkListStep[1]">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/warning"/>
						<xsl:if test="./checkListProcedure/@crewMemberType">
							<fo:block>
								<xsl:apply-templates select="./checkListProcedure/@crewMemberType"/>
							</fo:block>
						</xsl:if>
						<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/para"/>
					</fo:table-cell>
					<xsl:choose>
						<xsl:when test="descendant::checkListProcedure/checkListStep[1]/equipmentNotAvailable">
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/equipmentNotAvailable"/>
							</fo:table-cell>
						</xsl:when>
						<xsl:when test="descendant::checkListProcedure/checkListStep[1]/remarks">
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/remarks"/>
							</fo:table-cell>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
				</xsl:otherwise>
			</xsl:choose>
		</fo:table-row>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep/checkListStep"/>
		
		
	</xsl:template>
	
	<xsl:template name="SpecInspect">
		<fo:table wrap-option="wrap" hyphenate="true" xsl:use-attribute-sets="standard.table.setup">
			<fo:table-column column-number="1" column-width="2%"/>
			<fo:table-column column-number="2" column-width="30%"/>
			<fo:table-column column-number="3" column-width="10%"/>
			<fo:table-column column-number="4" column-width="25%"/>
			<fo:table-column column-number="5" column-width="25%"/>
			<fo:table-column column-number="6" column-width="8%"/>
			<fo:table-header>
				<fo:table-row>
					<fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block></fo:block>
					</fo:table-cell>
					<fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Area Name and No.</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Aircraft Serial No.</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Date</fo:block>
					</fo:table-cell>
				</fo:table-row>
				<fo:table-row>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block></fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="left">
						<fo:block>Inspection Requirements</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Status</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Faults and/or Remarks</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Action Taken</fo:block>
					</fo:table-cell>
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding" 
						border-bottom="solid" border-bottom-width=".5pt" display-align="after" 
						font-size="8pt" font-weight="bold" text-align="center">
						<fo:block>Initial</fo:block>
					</fo:table-cell>
				</fo:table-row>
				
			</fo:table-header>
			<fo:table-body>
				<!-- 8/19/11 - kr - added check for wcn at checklist level -->
				<xsl:if test="child::warning or child::caution or child::note">
					<fo:table-row>
						<fo:table-cell number-columns-spanned="6">
							<xsl:apply-templates select="warning|caution|note"/>
						</fo:table-cell>
					</fo:table-row>
				</xsl:if>
				<xsl:apply-templates select="checkListItems" mode="specInspect"/>
			</fo:table-body>
		</fo:table>		
	</xsl:template>
	
	<xsl:template match="checkListItems" mode="specInspect">
		<xsl:apply-templates select="checkListItem" mode="specInspect"/>
	</xsl:template>
	
	<xsl:template match="checkListItem" mode="specInspect">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding"/>
			<xsl:choose>
				<xsl:when test=" descendant::checkListProcedure/checkListPara">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/warning | descendant::checkListProcedure/caution"/>
						<xsl:apply-templates select="descendant::checkListProcedure/checkListPara/para"/>
					</fo:table-cell>
				</xsl:when>
				<xsl:when test="descendant::checkListProcedure/checkListStep[1]">
					<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
						<xsl:apply-templates select="descendant::checkListProcedure/checkListStep/warning"/>
						<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/para"/>
					</fo:table-cell>
				</xsl:when>
				<xsl:otherwise>
				</xsl:otherwise>
			</xsl:choose>
		</fo:table-row>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[1]/checkListStep/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep"/>
		<xsl:apply-templates select="descendant::checkListProcedure/checkListStep[position()!=1]/checkListStep/checkListStep/checkListStep"/>
	</xsl:template>
	
</xsl:stylesheet>


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