/ .. / / -> 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">
	
	<xsl:template match="crew">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="descrCrew">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="crewRefCard">
		<fo:block start-indent="21mm">
			<xsl:apply-templates/>
		</fo:block>	
	</xsl:template>

	<xsl:template match="crewRefCard/title">
		<fo:block xsl:use-attribute-sets="centerhead1">
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>
	
	<xsl:template match="crewDrill | subCrewDrill">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="crewDrill/title">
		<fo:block xsl:use-attribute-sets="centerhead2">
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>
	
	<xsl:template match="subCrewDrill/title">
		<fo:block font-weight="bold" space-after="8pt" keep-with-next="always">
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>	
	
	<xsl:template match="crewDrillStep">
		<xsl:apply-templates/>
	</xsl:template>
	
	
	
	<xsl:template match="crewDrillStep/title">
		<xsl:apply-templates/>
	</xsl:template>
	
	
	<xsl:template match="challengeAndResponse">
		<fo:table width="6.0in" margin-bottom="10pt" 
			margin-top="8pt" padding-bottom="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"
			text-align="left">
			<fo:table-column column-number="1" column-width="proportional-column-width(6)"/>
			<fo:table-column column-number="2" column-width="proportional-column-width(4)"/>
			<fo:table-body>
				<fo:table-row>
					<xsl:apply-templates select="challenge"/>
					<fo:table-cell start-indent="2pt">
						<xsl:apply-templates select="crewMemberGroup | response"/>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
		</fo:table>		
		
	</xsl:template>
	
	<xsl:template match="challenge">
		<xsl:variable name="step-number">
			<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
		</xsl:variable>
		<xsl:variable name="string-step-number" select="string($step-number)"/>
		<xsl:variable name="node-step-len"><xsl:value-of select="string-length($string-step-number)"/></xsl:variable>
		<xsl:variable name="step-len" select="string($node-step-len)"/>
		<fo:table-cell>
			<fo:list-block 
				provisional-label-separation="2mm"
				space-after="8pt" provisional-distance-between-starts="14mm">
				<xsl:attribute name="start-indent">
					<xsl:value-of select="(count(ancestor::crewDrillStep)+count(ancestor::if)+count(ancestor::elseIf)-1)*7"/>
					<xsl:text>mm</xsl:text>
				</xsl:attribute>
				<fo:list-item space-after="8pt">
					<xsl:call-template name="CHECK-ID"> </xsl:call-template>
					<fo:list-item-label
						end-indent="label-end()"
						text-align="end">
						<fo:block dominant-baseline="central">
							
													
							<fo:inline font-weight="bold">
							<xsl:apply-templates select="../../@crewStepCondition"></xsl:apply-templates>
							<xsl:text>  </xsl:text>
							</fo:inline>
							<xsl:choose>
								<xsl:when test="contains(../../@crewStepCondition, 'csc51')">
									<fo:instream-foreign-object content-height="12pt"> 
										<svg:svg xmlns:svg="http://www.w3.org/2000/svg"
											height="60">
											<xsl:attribute name="width"><xsl:value-of select="30*$step-len"/></xsl:attribute>
											<xsl:attribute name="viewBox"><xsl:text>0 0 </xsl:text><xsl:value-of select="30*$step-len"/><xsl:text> 60</xsl:text></xsl:attribute>
											<svg:ellipse cy="25" ry="25"
											fill="none" stroke="black" stroke-width="3">
											<xsl:attribute name="cx"><xsl:value-of select="15*$step-len"/></xsl:attribute>
											<xsl:attribute name="rx"><xsl:value-of select="15*$step-len"/></xsl:attribute>
											</svg:ellipse>
											<text x="15" y="40" font-family="Arial" font-size="50" fill="black" >
												<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
											</text>
										</svg:svg> 
									</fo:instream-foreign-object>			
								</xsl:when>
								<xsl:otherwise>
									<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
								</xsl:otherwise>
							</xsl:choose>
							
						</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>
			
		</fo:table-cell>
	</xsl:template>
	
	<xsl:template match="response">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="crewProcedureName">
		<xsl:variable name="step-number">
			<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
		</xsl:variable>
		<xsl:variable name="string-step-number" select="string($step-number)"/>
		<xsl:variable name="node-step-len"><xsl:value-of select="string-length($string-step-number)"/></xsl:variable>
		<xsl:variable name="step-len" select="string($node-step-len)"/>
		<fo:block space-after="8pt">
			<fo:list-block 
			provisional-label-separation="2mm"
			space-after="8pt" provisional-distance-between-starts="14mm">
				<xsl:attribute name="start-indent">
					<xsl:value-of select="(((count(ancestor::crewDrillStep)+count(ancestor::if)+count(ancestor::elseIf)-1)*7)+21)"/>
					<xsl:text>mm</xsl:text>
				</xsl:attribute>
				<fo:list-item space-after="8pt">
					<xsl:call-template name="CHECK-ID"> </xsl:call-template>
					<fo:list-item-label
						end-indent="label-end()"
						text-align="end">
						<fo:block>
							<fo:inline font-weight="bold">
								<xsl:apply-templates select="../../@crewStepCondition"></xsl:apply-templates>
								<xsl:text>  </xsl:text></fo:inline>
							<xsl:choose>
								<xsl:when test="contains(../../@crewStepCondition, 'csc51')">
									<fo:instream-foreign-object content-height="11pt"> 
										<svg:svg xmlns:svg="http://www.w3.org/2000/svg"
											height="60">
											<xsl:attribute name="width"><xsl:value-of select="30*$step-len"/></xsl:attribute>
											<xsl:attribute name="viewBox"><xsl:text>0 0 </xsl:text><xsl:value-of select="30*$step-len"/><xsl:text> 60</xsl:text></xsl:attribute>
											<svg:ellipse cy="25" ry="25"
												fill="none" stroke="black" stroke-width="3">
												<xsl:attribute name="cx"><xsl:value-of select="15*$step-len"/></xsl:attribute>
												<xsl:attribute name="rx"><xsl:value-of select="15*$step-len"/></xsl:attribute>
											</svg:ellipse>
											<text x="15" y="40" font-family="Arial" font-size="50" fill="black" >
												<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
											</text>
										</svg:svg> 
									</fo:instream-foreign-object>			
								</xsl:when>
								<xsl:otherwise>
									<xsl:number count="crewDrillStep" level="any" from="crewDrill|subCrewDrill" format="1."/>
								</xsl:otherwise>
							</xsl:choose>
						</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>
		</fo:block>
	</xsl:template>
	
	<xsl:template match="if">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="elseIf">
		<xsl:apply-templates/>
	</xsl:template>

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

	<xsl:template match="caseCond">
		<fo:block font-style="italic" space-after="8pt" keep-with-next="always">
			<xsl:attribute name="start-indent">
				<xsl:value-of select="((count(ancestor::crewDrillStep)+count(ancestor::if)+count(ancestor::elseIf))*7)+21"/>
				<xsl:text>mm</xsl:text>
			</xsl:attribute>
			<xsl:choose>
				<xsl:when test="parent::if">
					<xsl:text>If </xsl:text>
				</xsl:when>
				<xsl:when test="parent::elseIf">
					<xsl:text>Else if </xsl:text>
				</xsl:when>
				<xsl:when test="parent::case">
					<xsl:text>Case </xsl:text>
				</xsl:when>
			</xsl:choose>
			<xsl:apply-templates/>
		</fo:block>
	</xsl:template>
		
	<xsl:template match="crewMemberGroup">
		<fo:block font-style="italic" linefeed-treatment="treat-as-zero-width-space" white-space-collapse="true">
			<xsl:text>(</xsl:text>
			<xsl:if test="@actionResponsibility">
				<fo:inline text-transform="uppercase"><xsl:value-of select="@actionResponsibility"/></fo:inline><xsl:text> of </xsl:text>
			</xsl:if>
			<xsl:apply-templates/>
			<xsl:text>)</xsl:text>
		</fo:block>
	</xsl:template>

	<xsl:template match="crewMember">
		<xsl:if test="preceding-sibling::crewMember">
			<xsl:text>, </xsl:text>
		</xsl:if>
		<xsl:apply-templates select="@crewMemberType"/>
	</xsl:template>
	
	<xsl:template match="endMatter">
		<xsl:apply-templates/>
	</xsl:template>

</xsl:stylesheet>


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