<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" extension-element-prefixes="xalan" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink"
                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             *
*                                                              *
* Description primary import transform                         *
* Version   Date         By                                    *
* 0.2b      2006-08-21   Ian Proudfoot, iTP-X                  *
*                                                              *
****************************************************************
-->

	<xsl:import href="copy221.gen.xsl"/>
	<xsl:include href="attr221.imp.xsl"/>
	<xsl:include href="figs221.imp.xsl"/>
	<xsl:include href="brex221.imp.xsl"/>
	<xsl:include href="refs221.imp.xsl"/>
	<xsl:include href="tocs221.imp.xsl"/>
	<xsl:include href="frpi221.imp.xsl"/>
	<xsl:include href="cals221.imp.xsl"/>
	<xsl:include href="xref221.imp.xsl"/>

	<xsl:strip-space elements="*"/>

	<xsl:param name="start.mode"/>

	<xsl:output doctype-public="-//iTP-X//DTD FrameMaker XML S1000D Description 20060728//EN" doctype-system="desc221.fmx.dtd" method="xml" indent="yes"/>

	<xsl:template match="dmodule">
		<xsl:element name="dmodule">
			<xsl:attribute name="xmlns:xlink">http://www.w3.org/1999/xlink</xsl:attribute>
			<xsl:attribute name="xmlns:rdf">http://www.w3.org/1999/02/22-rdf-syntax-ns#</xsl:attribute>
			<xsl:attribute name="xmlns:fm">http://www.itp-x.co.uk/xslt</xsl:attribute>
			<xsl:attribute name="xmlns:dc">http://www.purl.org/dc/elements/1.1/</xsl:attribute>
			<xsl:attribute name="xmlns:xsi">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
			<xsl:attribute name="xmlns:dm">http://www.s1000d.org/dm</xsl:attribute>
			<xsl:attribute name="fm.dmtitle">
				<xsl:value-of select="//idstatus//techname"/>
				<xsl:text> - </xsl:text>
				<xsl:value-of select="//idstatus//infoname"/>
			</xsl:attribute>
			<xsl:if test="$start.mode='edit'">
				<xsl:attribute name="fm:display">
					<xsl:value-of select="$start.mode"/>
				</xsl:attribute>
			</xsl:if>
			<xsl:apply-templates/>
		</xsl:element>
		<xsl:call-template name="brex"/>
	</xsl:template>

	<fm:attconfig>
		<fm:attribute code="at">acrotype</fm:attribute>
		<fm:attribute code="cv">caveat</fm:attribute>
		<fm:attribute code="00">class</fm:attribute>
		<fm:attribute code="co">colour</fm:attribute>
		<fm:attribute code="cc">commcls</fm:attribute>
		<fm:attribute code="cp">cprio</fm:attribute>
		<fm:attribute code="cm">crewmem</fm:attribute>
		<fm:attribute code="dt">drilltyp</fm:attribute>
		<fm:attribute code="em">emph</fm:attribute>
		<fm:attribute code="pf">prefix</fm:attribute>
		<fm:attribute code="rt">rsptype</fm:attribute>
		<fm:attribute code="sk">skill</fm:attribute>
		<fm:attribute code="sl">sup.lev</fm:attribute>
		<fm:attribute code="lt">type</fm:attribute>
		<fm:attribute code="th">uom</fm:attribute>
	</fm:attconfig>

	<!-- **********************************************************************
    This template should really be in the file brex221.imp.xsl, but it does not
    write anything from that location for FrameMaker/XalanC. However it does 
	work as expected when tested with XalanJ and Saxon!
	***************************************************************************
	-->
	<xsl:template name="brex">
		<xsl:for-each select="document('')//fm:attribute">
			<xsl:variable name="attrconfig">
				<xsl:value-of select="."/>
			</xsl:variable>
			<xsl:variable name="attrcode">
				<xsl:value-of select="@code"/>
			</xsl:variable>
			<xsl:variable name="attrpath">
				<xsl:value-of select="concat($mifpath,'attr221.',$attrcode,'.mif')"/>
			</xsl:variable>

			<xalan:write select="$attrpath" method="text">
				<xsl:text disable-output-escaping="yes">&lt;EDAttrType FAttrChoice&gt;
&lt;EDAttrChoices</xsl:text>
				<xsl:for-each select="document($brexref)//objval">
					<xsl:if test="contains(preceding-sibling::objpath, $attrconfig)">
						<xsl:text disable-output-escaping="yes">
&lt;EDAttrChoice `</xsl:text>
						<xsl:value-of select="text()"/>
						<xsl:text disable-output-escaping="yes">'&gt;</xsl:text>
					</xsl:if>
				</xsl:for-each>
				<xsl:text disable-output-escaping="yes">
> # end of EDAttrChoices</xsl:text>
			</xalan:write>
		</xsl:for-each>
	</xsl:template>

	<!--Template to remove rdf metadata -->
	<xsl:template match="rdf:Description"/>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="no" name="ipd2" userelativepaths="yes" externalpreview="no" url="..\..\FrameMaker\IPD\DMC&#x2D;S1000DBIKE&#x2D;AAA&#x2D;D00&#x2D;00&#x2D;00&#x2D;0000&#x2D;941A&#x2D;A_000&#x2D;02.XML" htmlbaseurl="" outputurl="..\..\FrameMaker\IPD\IPDtoFrame.xml" processortype="xalan" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator="" ><parameterValue name="mifpath" value="'C:\blah'"/></scenario><scenario default="yes" name="Description" userelativepaths="yes" externalpreview="no" url="..\Examples\DMC&#x2D;S1000DBIKE&#x2D;AAA&#x2D;DA4&#x2D;00&#x2D;00&#x2D;0000&#x2D;041A&#x2D;A_000&#x2D;02.XML" htmlbaseurl="" outputurl="..\..\FrameMaker\IPD\IPDtoFrame.xml" processortype="xalan" useresolver="no" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator="" ><parameterValue name="mifpath" value="'C:\blah'"/></scenario></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="..\..\FrameMaker\IPD\DMC&#x2D;S1000DBIKE&#x2D;AAA&#x2D;D00&#x2D;00&#x2D;00&#x2D;0000&#x2D;941A&#x2D;A_000&#x2D;02.XML" srcSchemaRoot="dmodule" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"></template><template match="rdf:Description"></template><template match="dmodule[1]"></template><template match="dmodule"></template><template match="csn"><block path="xsl:if" x="404" y="144"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each" x="404" y="252"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element/xsl:element/xsl:attribute/xsl:value&#x2D;of" x="404" y="324"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if" x="444" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:attribute/xsl:value&#x2D;of" x="324" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:attribute[1]/xsl:value&#x2D;of" x="284" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:attribute[2]/xsl:value&#x2D;of" x="244" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:if" x="164" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:if/xsl:attribute/xsl:value&#x2D;of" x="204" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if/xsl:element/xsl:attribute[3]/xsl:value&#x2D;of" x="124" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]" x="364" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]/xsl:element/xsl:attribute[1]/xsl:value&#x2D;of" x="84" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]/xsl:element/xsl:attribute[2]/xsl:value&#x2D;of" x="44" y="261"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]/xsl:element/xsl:if" x="364" y="221"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]/xsl:element/xsl:if/xsl:attribute/xsl:value&#x2D;of" x="444" y="221"/><block path="xsl:element/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:element[4]/xsl:if[1]/xsl:element/xsl:attribute[3]/xsl:value&#x2D;of" x="324" y="221"/></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->