<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fm="http://www.itp-x.co.uk/xslt">

<!--
****************************************************************
* ADOBE SYSTEMS INCORPORATED                                   *
* Copyright 2006 © 2006 Adobe Systems Incorporated             *
* All Rights Reserved                                          *
*                                                              *
* NOTICE:  Adobe permits you to use, modify, and distribute    *
* this file in accordance with the terms of the Adobe license  *
* agreement accompanying it.  If you have received this file   *
* from a source other than Adobe, then your use, modification, *
* or distribution of it requires the prior written permission  *
* of Adobe.                                                    *
* _____________________________________________________________*
* Adobe FrameMaker 7.2 Application Pack for S1000D             *
*                                                              *
* Preliminary requirements export transform                    *
* Version   Date         By                                    *
* 0.2b      2006-08-21   Ian Proudfoot, iTP-X                  *
*                                                              *
****************************************************************
-->
	<xsl:template match="prelreqs/@id"/>



	<xsl:template match="reqconds">
		<xsl:element name="reqconds">
			<xsl:for-each select="descendant::noconds | descendant::reqcond | descendant::reqcondm | descendant::reqcondtp">
				<xsl:apply-templates select="."/>
			</xsl:for-each>
		</xsl:element>
	</xsl:template>

	<xsl:template match="reqpers">
		<xsl:element name="reqpers">
			<xsl:copy-of select="@*"/>
			<xsl:for-each select="descendant::person | descendant::asrequir">
				<xsl:variable name="reqpers-id" select="generate-id()"/>
				<xsl:copy-of select="."/>
				<xsl:copy-of select="following::perscat[generate-id(preceding::person)=$reqpers-id]"/>
				<xsl:apply-templates select="following::perskill[generate-id(preceding::person)=$reqpers-id]"/>
				<xsl:copy-of select="following::trade[generate-id(preceding::person)=$reqpers-id]"/>
				<xsl:copy-of select="following::esttime[generate-id(preceding::person)=$reqpers-id]"/>
			</xsl:for-each>
		</xsl:element>
	</xsl:template>

	<!--Support Equipment-->
	<xsl:template match="supequip">
		<xsl:element name="supequip">
			<xsl:choose>
				<xsl:when test="supeqli/fm:none.row">
					<xsl:element name="nosupeq"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element name="supeqli">
						<xsl:for-each select="supeqli/supequi">
							<xsl:element name="supequi">
								<xsl:copy-of select="@*"/>
								<xsl:copy-of select="fm:nomen/applic"/>
								<xsl:copy-of select="fm:nomen/nomen"/>
								<xsl:copy-of select="fm:ident/csnref"/>
								<xsl:copy-of select="fm:ident/nsn"/>
								<xsl:copy-of select="fm:ident/identno"/>
								<xsl:copy-of select="fm:ident/refs"/>
								<xsl:copy-of select="fm:qty/qty"/>
								<xsl:copy-of select="fm:ident/remarks"/>
							</xsl:element>
						</xsl:for-each>
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:element>
	</xsl:template>

	<!--Supplies-->
	<xsl:template match="supplies">
		<xsl:element name="supplies">
			<xsl:choose>
				<xsl:when test="supplyli/fm:none.row">
					<xsl:element name="nosupply"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element name="supplyli">
						<xsl:for-each select="supplyli/supply">
							<xsl:element name="supply">
								<xsl:copy-of select="@*"/>
								<xsl:copy-of select="fm:nomen/applic"/>
								<xsl:copy-of select="fm:nomen/nomen"/>
								<xsl:copy-of select="fm:ident/csnref"/>
								<xsl:copy-of select="fm:ident/nsn"/>
								<xsl:copy-of select="fm:ident/identno"/>
								<xsl:copy-of select="fm:ident/refs"/>
								<xsl:copy-of select="fm:qty/qty"/>
								<xsl:copy-of select="fm:ident/remarks"/>
							</xsl:element>
						</xsl:for-each>
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:element>
	</xsl:template>

	<!--Spares-->
	<xsl:template match="spares">
		<xsl:element name="spares">
			<xsl:choose>
				<xsl:when test="sparesli/fm:none.row">
					<xsl:element name="nospares"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element name="sparesli">
						<xsl:for-each select="sparesli/spare">
							<xsl:element name="spare">
								<xsl:copy-of select="@*"/>
								<xsl:copy-of select="fm:nomen/applic"/>
								<xsl:copy-of select="fm:nomen/nomen"/>
								<xsl:copy-of select="fm:ident/csnref"/>
								<xsl:copy-of select="fm:ident/nsn"/>
								<xsl:copy-of select="fm:ident/identno"/>
								<xsl:copy-of select="fm:ident/refs"/>
								<xsl:copy-of select="fm:qty/qty"/>
								<xsl:copy-of select="fm:ident/remarks"/>
							</xsl:element>
						</xsl:for-each>
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="copy" userelativepaths="yes" externalpreview="no" url="..\Examples\DMC&#x2D;S1000DBIKE&#x2D;AAA&#x2D;DA2&#x2D;30&#x2D;00&#x2D;0000&#x2D;520A&#x2D;A_001&#x2D;02.XML" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->