<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:Locale="urn:Locale-namespace">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:include href="DefaultPrint-r102.xsl"/>
	<xsl:include href="Locale.xsl"/>
	<xsl:param name="printtype">Full</xsl:param>
	<xsl:variable name="NativePressureUnits">psi</xsl:variable>
	<xsl:variable name="TheSchema" select="document('AltusA30RI-Method-r100.xsd')"/>
	<xsl:variable name="LanguageSubfolder" select="Locale:LanguageSubfolder()"/>
	<xsl:variable name="ResourceFile" select="concat($LanguageSubfolder,'\\AltusA30RI-Resource-r100.xml')"/>
	<xsl:variable name="TheResources" select="document(string($ResourceFile))"/>
	<!-- Don't emit RiuDataEnable -->
	<xsl:template match="RiuDataEnable"/>
	<!-- Don't emit event table if brief or summary report is requested -->
	<xsl:template match="EventTable">
		<xsl:if test="($printtype = 'Full' or $printtype = 'Plain Text') and (/AltusA30RIMethod/PurgeEnable = 'false')">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="TimeConstant | DataRate | InitialSwitchState | FlowCellTempDataEnable">
		<xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="Description">
		<xsl:call-template name="Emit"/>
		<xsl:text disable-output-escaping="yes">
			&lt;/FieldList&gt;
		</xsl:text>
	</xsl:template>

	<xsl:template match="PulseWidth | RectWavePeriod">
		<xsl:if test="($printtype != 'Brief') and (/AltusA30RIMethod/PurgeEnable = 'false') and (/AltusA30RIMethod/RunEvents = 'true' or /AltusA30RIMethod/Threshold/Enable = 'true')">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<!-- Customize text for boolean On/Off at end of FieldList -->
	<xsl:template match="PurgeEnable">
		<xsl:call-template name="Emit-Field-Value-Prompt">
			<xsl:with-param name="InputVar" select="name()"/>
			<xsl:with-param name="InputType">String</xsl:with-param>
			<xsl:with-param name="InputPrecision">0</xsl:with-param>
			<xsl:with-param name="InputValue">
				<xsl:choose>
					<xsl:when test=". = 'true'">
						<xsl:value-of select="$TheResources//Enum[@id='Purge_1']/@value"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$TheResources//Enum[@id='Normal_0']/@value"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="InputPrompt">
				<xsl:value-of select="$TheResources//Type[@name='tPurgeEnableEnum']/@prompt"/>
			</xsl:with-param>
			<xsl:with-param name="InputUnits">None</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<!-- Customize text for boolean On/Off at end of FieldList -->
	<xsl:template match="RecycleEnable">
		<xsl:call-template name="Emit-Field-Value-Prompt">
			<xsl:with-param name="InputVar" select="name()"/>
			<xsl:with-param name="InputType">String</xsl:with-param>
			<xsl:with-param name="InputPrecision">0</xsl:with-param>
			<xsl:with-param name="InputValue">
				<xsl:choose>
					<xsl:when test=". = 'true'">
						<xsl:value-of select="$TheResources//Enum[@id='Recycle_0']/@value"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$TheResources//Enum[@id='Waste_1']/@value"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="InputPrompt">
				<xsl:value-of select="$TheResources//Type[@name='tRecycleEnableEnum']/@prompt"/>
			</xsl:with-param>
			<xsl:with-param name="InputUnits">None</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<!-- Customize text for boolean On/Off at end of FieldList -->
	<xsl:template match="Polarity">
		<xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'InversePolarity_0'">
							<xsl:value-of select="$TheResources//Enum[@id='InversePolarity_0']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='NormalPolarity_1']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tPolarity']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!-- Customize text for boolean Yes/No before end of FieldList -->
	<xsl:template match="AutoZeroInjectStart">
		<xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'true'">
							<xsl:value-of select="$TheResources//Enum[@id='BooleanYes_1A']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='BooleanNo_0A']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tAutoZeroInjectStart']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

	<xsl:template match="FlowCellTempDataEnable">
		<xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">

			<!--<xsl:call-template name="Emit"/>-->
			
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'true'">
							<xsl:value-of select="$TheResources//Enum[@id='BooleanYes_1A']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='BooleanNo_0A']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tFlowCellTempDataEnable']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>

		</xsl:if>
	</xsl:template>

	<!-- Customize text for boolean Yes/No before end of FieldList -->
	<xsl:template match="RunEvents">
		<xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'true'">
							<xsl:value-of select="$TheResources//Enum[@id='BooleanYes_1A']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='BooleanNo_0A']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tRunEvents']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!-- Exclude analog values out from Brief and purge -->
	<xsl:template match="RIUnitsFullScale | OutputFullScale | VoltageOffset">
		<xsl:if test="($printtype != 'Brief') and (/AltusA30RIMethod/PurgeEnable = 'false')">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<!-- Exclude threshold unless printtype is Full and threshold is enabled -->
	<xsl:template match="ThresholdEvent">
		<xsl:if test="($printtype = 'Full' or $printtype = 'Plain Text') and (/AltusA30RIMethod/PurgeEnable = 'false')">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

  <xsl:template match="ThresholdEvent/Enable">
    <xsl:if test="/AltusA30RIMethod/PurgeEnable = 'false'">
      <xsl:call-template name="Emit-Field-Value-Prompt">
        <xsl:with-param name="InputVar" select="name()"/>
        <xsl:with-param name="InputType">String</xsl:with-param>
        <xsl:with-param name="InputPrecision">0</xsl:with-param>
        <xsl:with-param name="InputValue">
          <xsl:choose>
            <xsl:when test=". = 'true'">
              <xsl:value-of select="$TheResources//Enum[@id='BooleanEnable_1D']/@value"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$TheResources//Enum[@id='BooleanDisable_0D']/@value"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:with-param>
        <xsl:with-param name="InputPrompt">
          <xsl:value-of select="$TheResources//Type[@name='tThresholdEnable']/@prompt"/>
        </xsl:with-param>
        <xsl:with-param name="InputUnits">None</xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template match="ThresholdEvent/Threshold">
    <xsl:if test="(/AltusA30RIMethod/ThresholdEvent/Enable = 'true') and(/AltusA30RIMethod/PurgeEnable = 'false')">
      <xsl:call-template name="Emit"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="ThresholdEvent/Event"/>

  <xsl:template match="ThresholdEvent/Action">
    <xsl:if test="(/AltusA30RIMethod/ThresholdEvent/Enable = 'true') and(/AltusA30RIMethod/PurgeEnable = 'false')">
      <xsl:call-template name="Emit"/>
    </xsl:if>
  </xsl:template>

  <!-- Customize text for boolean Yes/No before end of FieldList -->
	<xsl:template match="FlowCellTempEnable">
		<xsl:if test=". = 'false'">
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'true'">
							<xsl:value-of select="$TheResources//Enum[@id='EnableTemperature_1']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='EnableTemperature_0']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tEnableTemperature']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

	<xsl:template match="FlowCellTempSetpoint">
		<xsl:if test="/AltusA30RIMethod/FlowCellTempEnable = 'true'">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<!-- Customize text for boolean Yes/No before end of FieldList -->
	<xsl:template match="FlowCellTempAlarmEnable">
		<xsl:if test="(. = 'false') and (/AltusA30RIMethod/FlowCellTempEnable = 'true') and (/AltusA30RIMethod/PurgeEnable = 'false')">
			<xsl:call-template name="Emit-Field-Value-Prompt">
				<xsl:with-param name="InputVar" select="name()"/>
				<xsl:with-param name="InputType">String</xsl:with-param>
				<xsl:with-param name="InputPrecision">0</xsl:with-param>
				<xsl:with-param name="InputValue">
					<xsl:choose>
						<xsl:when test=". = 'true'">
							<xsl:value-of select="$TheResources//Enum[@id='EnableTemperature_1']/@value"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$TheResources//Enum[@id='EnableTemperature_0']/@value"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:with-param>
				<xsl:with-param name="InputPrompt">
					<xsl:value-of select="$TheResources//Type[@name='tEnableTemperatureLimit']/@prompt"/>
				</xsl:with-param>
				<xsl:with-param name="InputUnits">None</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>

	<xsl:template match="FlowCellTemperatureLimit">
		<xsl:if test="(/AltusA30RIMethod/FlowCellTempAlarmEnable = 'true') and (/AltusA30RIMethod/FlowCellTempEnable = 'true') and (/AltusA30RIMethod/PurgeEnable = 'false')">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

	<xsl:template match="AltusA30RIMethod">
		<xsl:element name="AltusA30RIMethod">
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>

</xsl:stylesheet>
