/ .. / / -> 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">
	<!-- 9/14/11 - kr - adjusted column widths -->
	
	<xsl:template match="preliminaryRqmts">
		<fo:block xsl:use-attribute-sets="centerhead2">
			<xsl:text>Preliminary requirements</xsl:text>
		</fo:block>
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="closeRqmts">
		<fo:block  xsl:use-attribute-sets="centerhead2">
			<xsl:text>Requirements after job completion</xsl:text>
		</fo:block>
		<xsl:apply-templates/>
	</xsl:template>

	<!-- @reqCondCategory-->
	<!-- from 3031 - Attribute values shall be used as defined in the following table.
	See TABLE XXV (Attribute values – reqCondCategory) in the Attribute values Tables sheet.-->
	<xsl:template match="reqCondGroup">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Required conditions</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Required conditions</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<fo:table-column column-number="1" column-width="7%"/>
					<fo:table-column column-number="2" column-width="13%"/>
					<fo:table-column column-number="3" column-width="36%"/>
					<!-- 9/14/11 - kr - adjusted column widths -->
					<fo:table-column column-number="4" column-width="14%"/>
					<fo:table-column column-number="5" column-width="30%"/>
					<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 number-columns-spanned="3"
								xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Action/Condition</fo:block>
							</fo:table-cell>
							<fo:table-cell number-columns-spanned="2"
								xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Data module/Technical
									publication</fo:block>
							</fo:table-cell>
						</fo:table-row>
						<xsl:if test="child::reqCondCircuitBreaker">
							<fo:table-row border-before-style="solid" border-before-width="0.25pt">
								<fo:table-cell/>
								<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
									<fo:block xsl:use-attribute-sets="column-title">Panel</fo:block>
								</fo:table-cell>
								<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
									<fo:block xsl:use-attribute-sets="column-title">Designation</fo:block>
								</fo:table-cell>
								<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
									<fo:block xsl:use-attribute-sets="column-title">CB</fo:block>
								</fo:table-cell>
								<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
									<fo:block xsl:use-attribute-sets="column-title">Location</fo:block>
								</fo:table-cell>
							</fo:table-row>
						</xsl:if>
					</fo:table-header>
					<fo:table-body>
						<xsl:choose>
							<xsl:when test="child::noConds">
								<fo:table-row>
									<fo:table-cell number-columns-spanned="3"
										xsl:use-attribute-sets="table.cell.padding">
										<fo:block>
											<xsl:text>None</xsl:text>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</xsl:when>
							<xsl:otherwise>
								<xsl:apply-templates/>
							</xsl:otherwise>
						</xsl:choose>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template name="required-condition">
		<fo:table-cell number-columns-spanned="3" xsl:use-attribute-sets="table.cell.padding">
			<fo:block>
				<xsl:value-of select="reqCond"/>
			</fo:block>
		</fo:table-cell>
	</xsl:template>

	<xsl:template match="reqCondNoRef">
		<fo:table-row>
			<xsl:call-template name="required-condition"/>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqCondDm">
		<fo:table-row>
			<xsl:call-template name="required-condition"/>
			<fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="dmRef"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqCondPm">
		<fo:table-row>
			<xsl:call-template name="required-condition"/>
			<fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="pmRef"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqCondExternalPub">
		<fo:table-row>
			<xsl:call-template name="required-condition"/>
			<fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="externalPubRef"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqCondCircuitBreaker">
		<fo:table-row border-before-style="solid" border-before-width="0.25pt">
			<xsl:call-template name="required-condition"/>
		</fo:table-row>
		<xsl:apply-templates select="circuitBreakerDescrGroup"/>
	</xsl:template>

	<xsl:template match="circuitBreakerDescrGroup">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="circuitBreakerDescrSubGroup">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="circuitBreakerDescr">
		<fo:table-row>
			<fo:table-cell/>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="accessPointRef/@accessPointNumber"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="name"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="circuitBreakerRef/@circuitBreakerNumber"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="circuitBreakerLocation"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="circuitBreakerLocation">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="reqPersons">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Required persons</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Required persons</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<fo:table-column column-number="1" column-width="15%"/>
					<fo:table-column column-number="2" column-width="15%"/>
					<fo:table-column column-number="3" column-width="15%"/>
					<fo:table-column column-number="4" column-width="25%"/>
					<fo:table-column column-number="5" column-width="30%"/>
					<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 xsl:use-attribute-sets="column-title">Quantity</fo:block>
							</fo:table-cell>
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Category</fo:block>
							</fo:table-cell>
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Skill level</fo:block>
							</fo:table-cell>
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Trade/Trade code</fo:block>
							</fo:table-cell>
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Estimated time</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-header>
					<fo:table-body>
						<xsl:apply-templates select="personnel"/>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template match="personnel">
		<fo:table-row>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="@numRequired">
							<xsl:value-of select="@numRequired"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>As required</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="personCategory"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="personSkill"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="trade"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="estimatedTime"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="personCategory">
		<xsl:value-of select="@personCategoryCode"/>
	</xsl:template>

<!-- 3031: Only the defined values are allowed for the attribute skillLevelCode, refer to 5.48.1.31. (from plp - See TABLE XXXI (Attribute values – skillLevelCode) in the Attribute values Tables sheet.)-->
	<xsl:template match="personSkill">
		<xsl:choose>
			<xsl:when test="@skillLevelCode='sk01'">
				<xsl:text>Basic</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk02'">
				<xsl:text>Intermediate</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk03'">
				<xsl:text>Advanced</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk51'">
				<xsl:text>Skill level 1</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk52'">
				<xsl:text>Skill level 2</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk53'">
				<xsl:text>Skill level 3</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk54'">
				<xsl:text>Skill level 4</xsl:text>
			</xsl:when>
			<xsl:when test="@skillLevelCode='sk55'">
				<xsl:text>Skill level 5</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<fo:inline color="red">
					<xsl:text>Error</xsl:text>
				</fo:inline>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="trade">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="estimatedTime">
		<xsl:apply-templates/>
		<xsl:text> </xsl:text>
		<xsl:value-of select="@unitOfMeasure"/>
	</xsl:template>
	
	<!-- 3031: Attribute values shall be used as defined in the following table.
		See TABLE XXXIV (Attribute values – thresholdUnitOfMeasure) in the Attribute values Tables sheet. -->
	<xsl:template match="thresholdInterval">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<fo:block xsl:use-attribute-sets="column-title">
					<xsl:choose>
						<xsl:when test="count(preceding::thresholdInterval)='0'">
							<xsl:text>Threshold interval</xsl:text>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates/>
					<xsl:text> </xsl:text>
					<xsl:if test="@thresholdUnitOfMeasure">
						<xsl:choose>
							<xsl:when test="@thresholdUnitOfMeasure='th01'">
								<xsl:text>Flight hours</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th02'">
								<xsl:text>Flight cycles</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th03'">
								<xsl:text>Months</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th04'">
								<xsl:text >Weeks</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th05'">
								<xsl:text >Years</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th06'">
								<xsl:text >Days</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th07'">
								<xsl:text >Supersonic cycles</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th08'">
								<xsl:text >Pressure cycles</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th09'">
								<xsl:text >Engine cycles</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th10'">
								<xsl:text >Engine change</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th11'">
								<xsl:text >Shop visits</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th12'">
								<xsl:text >Auxiliary power unit change</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th13'">
								<xsl:text >Landing gear change</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th14'">
								<xsl:text >Wheel change</xsl:text>
							</xsl:when>
							<xsl:when test="@thresholdUnitOfMeasure='th15'">
								<xsl:text >Engine start</xsl:text>
							</xsl:when>
							<xsl:otherwise/>
						</xsl:choose>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>
	
	<xsl:template match="zoneRef">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<fo:block xsl:use-attribute-sets="column-title">
					<xsl:choose>
						<xsl:when test="count(preceding::zoneRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
							<xsl:text>Zone</xsl:text>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="count(preceding::zoneRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
					<xsl:if test="@zoneNumber">
						<xsl:value-of select="@zoneNumber"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="count(preceding::zoneRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
					<xsl:if test="name">
						<xsl:apply-templates select="name"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="accessPointRef">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<fo:block xsl:use-attribute-sets="column-title">
					<xsl:choose>
						<xsl:when test="count(preceding::accessPointRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
							<xsl:text>Access points</xsl:text>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="count(preceding::accessPointRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
						</xsl:when>
						<xsl:otherwise/>
					</xsl:choose>
					<xsl:if test="@accessPointNumber">
						<xsl:value-of select="@accessPointNumber"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
			<!-- 3031: Attribute values shall be used as defined in the following table.  
				See Table III (Attribute values - accessPointtypeValue) in the Attribute values Tables sheet.-->
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="count(preceding::accessPointRef)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
						</xsl:when>
						<xsl:otherwise/>
					</xsl:choose>
					<xsl:if test="@accessPointTypeValue">
						<xsl:choose>
							<xsl:when test="@accessPointTypeValue='accpnl01'">
								<xsl:text>Door</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl02'">
								<xsl:text>Panel</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl03'">
								<xsl:text>Electrical panel</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl51'">
								<xsl:text>Cover</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl52'">
								<xsl:text>Plate</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl53'">
								<xsl:text>Screen</xsl:text>
							</xsl:when>
							<xsl:when test="@accessPointTypeValue='accpnl54'">
								<xsl:text>Opening</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<fo:inline color="red">
									<xsl:text>Error - accessPointTypeValue </xsl:text>
									<xsl:value-of select="@accessPointTypeValue"/>
								</fo:inline>
								<xsl:text> prohibited</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:if>
					<xsl:if test="name">
						<xsl:if test="@accessPointTypeValue">
							<xsl:text> -</xsl:text>
							<fo:block/>
						</xsl:if>
						<xsl:apply-templates select="name"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>
	
	<xsl:template match="workArea">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<fo:block xsl:use-attribute-sets="column-title">
					<xsl:choose>
						<xsl:when test="count(preceding::workArea)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
							<xsl:text>Work area</xsl:text>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="count(preceding::workArea)='0'">
							<fo:block>
								<xsl:text>
</xsl:text>
							</fo:block>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
					<xsl:apply-templates/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="taskDuration">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="count(preceding::taskDuration)='0'">
						<fo:block>
							<xsl:text>
</xsl:text>
						</fo:block>
					</xsl:when>
					<xsl:otherwise></xsl:otherwise>
				</xsl:choose>
				<fo:block xsl:use-attribute-sets="column-title">
					<xsl:text>Maintenance task duration</xsl:text>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="count(preceding::taskDuration)='0'">
						<fo:block>
							<xsl:text>
</xsl:text>
						</fo:block>
					</xsl:when>
					<xsl:otherwise/>
				</xsl:choose>
				<fo:block>
					<xsl:text>Preliminary requirements</xsl:text>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<xsl:choose>
					<xsl:when test="count(preceding::taskDuration)='0'">
						<fo:block>
							<xsl:text>
</xsl:text>
						</fo:block>
					</xsl:when>
					<xsl:otherwise/>
				</xsl:choose>
				<fo:block>
					<xsl:value-of select="@startupDuration"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="@unitOfMeasure"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
		<fo:table-row>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:text>Procedure</xsl:text>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="@procedureDuration"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="@unitOfMeasure"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
		<fo:table-row>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:text>Closeup duration</xsl:text>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:value-of select="@closeupDuration"/>
					<xsl:text> </xsl:text>
					<xsl:value-of select="@unitOfMeasure"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="productionMaintData">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Production management data</xsl:text>
		</fo:block>
		<xsl:if test="thresholdInterval | zoneRef | accessPointRef | workArea | taskDuration">
			<fo:table xsl:use-attribute-sets="standard.table.setup">
				<fo:table-column column-number="1" column-width="33%"/>
				<fo:table-column column-number="2" column-width="33%"/>
				<fo:table-column column-number="3" column-width="33%"/>
				<fo:table-body>
					<xsl:if test="thresholdInterval">
						<xsl:apply-templates select="thresholdInterval"/>
					</xsl:if>
					<xsl:if test="zoneRef">
						<xsl:apply-templates select="zoneRef"/>
					</xsl:if>
					<xsl:if test="accessPointRef">
						<xsl:apply-templates select="accessPointRef"/>
					</xsl:if>
					<xsl:if test="workArea">
						<xsl:apply-templates select="workArea"/>
					</xsl:if>
					<xsl:if test="taskDuration">
						<xsl:apply-templates select="taskDuration"/>
					</xsl:if>
				</fo:table-body>
			</fo:table>
		</xsl:if>
	</xsl:template>

	<xsl:template name="create-reqconds-table-header">
		<fo:table-column column-number="1" column-width="20%"/>
		<fo:table-column column-number="2" column-width="45%"/>
		<fo:table-column column-number="3" column-width="15%"/>
		<fo:table-column column-number="4" column-width="20%"/>
		<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 xsl:use-attribute-sets="column-title">Name</fo:block>
				</fo:table-cell>
				<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
					<fo:block xsl:use-attribute-sets="column-title">CAGE/Reference</fo:block>
				</fo:table-cell>
				<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
					<fo:block xsl:use-attribute-sets="column-title">Quantity</fo:block>
				</fo:table-cell>
				<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
					<fo:block xsl:use-attribute-sets="column-title">Remark</fo:block>
				</fo:table-cell>
			</fo:table-row>
		</fo:table-header>
	</xsl:template>

	<xsl:template match="reqSupportEquips">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Support equipment</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Support equipment</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<xsl:call-template name="create-reqconds-table-header"/>
					<fo:table-body>
						<xsl:choose>
							<xsl:when test="child::noSupportEquips">
								<fo:table-row>
									<fo:table-cell number-columns-spanned="3"
										xsl:use-attribute-sets="table.cell.padding">
										<fo:block>
											<xsl:text>None</xsl:text>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</xsl:when>
							<xsl:otherwise>
								<xsl:apply-templates select="supportEquipDescrGroup"/>
							</xsl:otherwise>
						</xsl:choose>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template match="supportEquipDescrGroup">
		<xsl:apply-templates select="supportEquipDescr"/>
	</xsl:template>

	<xsl:template match="supportEquipDescr">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<xsl:call-template name="CHECK-ID"/> 
				<fo:block>
					<xsl:choose>
						<xsl:when test="name">
							<xsl:apply-templates select="name"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="shortName">
									<xsl:apply-templates select="shortName"/>
								</xsl:when>
								<xsl:otherwise/>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="catalogSeqNumberRef">
							<xsl:apply-templates select="catalogSeqNumberRef"/>
						</xsl:when>
						<xsl:when test="natoStockNumber">
							<xsl:attribute name="color">red</xsl:attribute>
							<xsl:text>Element natoStockNumber prohibited in element preliminaryRqmts</xsl:text>
						</xsl:when>
						<xsl:when test="identNumber">
							<xsl:apply-templates select="identNumber"/>
						</xsl:when>
						<xsl:when test="toolRef">
							<xsl:apply-templates select="toolRef"/>
						</xsl:when>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="reqQuantity"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="4" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:if test="remarks">
						<xsl:apply-templates select="remarks"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="shortName">
		<xsl:apply-templates/>
	</xsl:template>

	<!-- 3031: The following attributes of the element <natoStockNumber> shall be used:
		a. natoSupplyClass shall contain the four-digit Federal Supply Classification (FSC).-->
	<!-- 3031: b. natoCodificationBureau shall contain the first two digits of the National Item Identification Number (NIIN).-->
	<!-- 3031: c. natoItemIdentNumberCore shall contain the final seven digits of the NIIN.-->
	<xsl:template match="natoStockNumber">
		<xsl:text>NSN </xsl:text>
		<xsl:choose>
			<xsl:when test="@natoSupplyClass">
				<xsl:value-of select="@natoSupplyClass"/>
				<xsl:text>-</xsl:text>
				<xsl:choose>
					<xsl:when test="@natoCodificationBureau">
						<xsl:value-of select="@natoCodificationBureau"/>
						<xsl:text>-</xsl:text>
						<xsl:choose>
							<xsl:when test="@natoItemIdentNumberCore">
								<xsl:value-of select="substring(@natoItemIdentNumberCore, 1, 3)"/>
								<xsl:text>-</xsl:text>
								<xsl:value-of select="substring(@natoItemIdentNumberCore, 4, 4)"/>
							</xsl:when>
							<xsl:otherwise>
								<fo:inline color="red">Error: Missing NSN attributes.</fo:inline>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<fo:inline color="red">Error: Missing NSN attributes.</fo:inline>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>
			<xsl:otherwise>
				<fo:inline color="red">Error: Missing NSN attributes.</fo:inline>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="reqQuantity">
		<xsl:apply-templates/>
		<xsl:if test="@unitOfMeasure">
			<xsl:text> </xsl:text>
			<xsl:value-of select="@unitOfMeasure"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="preliminaryRqmts//remarks">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="reqSupplies">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Consumables, materials, and expendables</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Consumables, materials, and expendables</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<xsl:call-template name="create-reqconds-table-header"/>
					<fo:table-body>
						<xsl:choose>
							<xsl:when test="child::noSupplies">
								<fo:table-row>
									<fo:table-cell number-columns-spanned="3"
										xsl:use-attribute-sets="table.cell.padding">
										<fo:block>
											<xsl:text>None</xsl:text>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</xsl:when>
							<xsl:otherwise>
								<xsl:apply-templates select="supplyDescrGroup"/>
							</xsl:otherwise>
						</xsl:choose>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template match="supplyDescrGroup">
		<xsl:apply-templates select="supplyDescr"/>
	</xsl:template>

	<xsl:template match="supplyDescr">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<xsl:call-template name="CHECK-ID"/> 
				<fo:block>
					<xsl:choose>
						<xsl:when test="name">
							<xsl:apply-templates select="name"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="shortName">
									<xsl:apply-templates select="shortName"/>
								</xsl:when>
								<xsl:otherwise/>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="catalogSeqNumberRef">
							<xsl:apply-templates select="catalogSeqNumberRef"/>
						</xsl:when>
						<xsl:when test="natoStockNumber">
							<xsl:attribute name="color">red</xsl:attribute>
							<xsl:text>Element natoStockNumber prohibited in element preliminaryRqmts</xsl:text>
						</xsl:when>
						<xsl:when test="identNumber">
							<xsl:apply-templates select="identNumber"/>
						</xsl:when>
						<xsl:when test="toolRef">
							<xsl:apply-templates select="toolRef"/>
						</xsl:when>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="reqQuantity"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="4" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:if test="remarks">
						<xsl:apply-templates select="remarks"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqSpares">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Spares</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Spares</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<xsl:call-template name="create-reqconds-table-header"/>
					<fo:table-body>
						<xsl:choose>
							<xsl:when test="child::noSpares">
								<fo:table-row>
									<fo:table-cell number-columns-spanned="3"
										xsl:use-attribute-sets="table.cell.padding">
										<fo:block>
											<xsl:text>None</xsl:text>
										</fo:block>
									</fo:table-cell>
								</fo:table-row>
							</xsl:when>
							<xsl:otherwise>
								<xsl:apply-templates select="spareDescrGroup"/>
							</xsl:otherwise>
						</xsl:choose>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template match="spareDescrGroup">
		<xsl:apply-templates select="spareDescr"/>
	</xsl:template>

	<xsl:template match="spareDescr">
		<fo:table-row>
			<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
				<xsl:call-template name="CHECK-ID"/> 
				<fo:block>
					<xsl:choose>
						<xsl:when test="name">
							<xsl:apply-templates select="name"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="shortName">
									<xsl:apply-templates select="shortName"/>
								</xsl:when>
								<xsl:otherwise/>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:choose>
						<xsl:when test="catalogSeqNumberRef">
							<xsl:apply-templates select="catalogSeqNumberRef"/>
						</xsl:when>
						<xsl:when test="natoStockNumber">
							<xsl:attribute name="color">red</xsl:attribute>
							<xsl:text>Element natoStockNumber prohibited in element preliminaryRqmts</xsl:text>
						</xsl:when>
						<xsl:when test="identNumber">
							<xsl:apply-templates select="identNumber"/>
						</xsl:when>
						<xsl:when test="toolRef">
							<xsl:apply-templates select="toolRef"/>
						</xsl:when>
					</xsl:choose>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="3" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="reqQuantity"/>
				</fo:block>
			</fo:table-cell>
			<fo:table-cell column-number="4" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:if test="remarks">
						<xsl:apply-templates select="remarks"/>
					</xsl:if>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>

	<xsl:template match="reqSafety">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Safety conditions</xsl:text>
		</fo:block>
		<fo:block>
			<xsl:choose>
				<xsl:when test="child::noSafety">
					<xsl:text>None</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:apply-templates select="safetyRqmts"/>
				</xsl:otherwise>
			</xsl:choose>
		</fo:block>
	</xsl:template>

	<xsl:template match="safetyRqmts">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="reqTechInfoGroup">
		<fo:block xsl:use-attribute-sets="sidehead0">
			<xsl:text>Required technical information</xsl:text>
		</fo:block>
		<fo:block span="all">
			<fo:table-and-caption span="all">
				<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:text disable-output-escaping="no">  Required technical information</xsl:text>
					</fo:block>
				</fo:table-caption>
				<fo:table xsl:use-attribute-sets="standard.table.setup">
					<fo:table-column column-number="1" column-width="40%"/>
					<fo:table-column column-number="2" column-width="60%"/>
					<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 xsl:use-attribute-sets="column-title">Information type</fo:block>
							</fo:table-cell>
							<fo:table-cell xsl:use-attribute-sets="table.cell.padding">
								<fo:block xsl:use-attribute-sets="column-title">Data module/Technical
									publication</fo:block>
							</fo:table-cell>
						</fo:table-row>
					</fo:table-header>
					<fo:table-body>
						<xsl:apply-templates select="reqTechInfo"/>
					</fo:table-body>
				</fo:table>
			</fo:table-and-caption>
		</fo:block>
	</xsl:template>

	<xsl:template match="reqTechInfo">
		<fo:table-row>
			<!-- 3031: Attribute values shall be used as defined in the following table.
				See TABLE XXVI (Attribute values – reqTechInfoCategory) in the Attribute values Tables sheet.-->
			<xsl:if test="@reqTechInfoCategory">
				<fo:table-cell column-number="1" xsl:use-attribute-sets="table.cell.padding">
					<fo:block>
						<xsl:choose>
							<xsl:when test="@reqTechInfoCategory='ti01'">
								<xsl:text>Publication</xsl:text>
							</xsl:when>
							<xsl:when test="@reqTechInfoCategory='ti02'">
								<xsl:text>Data module</xsl:text>
							</xsl:when>
							<xsl:when test="@reqTechInfoCategory='ti03'">
								<xsl:text>Drawing</xsl:text>
							</xsl:when>
							<xsl:when test="@reqTechInfoCategory='ti04'">
								<xsl:text>Electrical diagram</xsl:text>
							</xsl:when>
							<xsl:when test="@reqTechInfoCategory='ti05'">
								<xsl:text>Schematic diagram</xsl:text>
							</xsl:when>
							<xsl:when test="@reqTechInfoCategory='ti06'">
								<xsl:text>Safety sheet</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text/>
							</xsl:otherwise>
						</xsl:choose>
					</fo:block>
				</fo:table-cell>
			</xsl:if>
			<fo:table-cell column-number="2" xsl:use-attribute-sets="table.cell.padding">
				<fo:block>
					<xsl:apply-templates select="dmRef | pmRef | externalPubRef"/>
				</fo:block>
			</fo:table-cell>
		</fo:table-row>
	</xsl:template>
</xsl:stylesheet>


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