<?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:variable name="NativePressureUnits">psi</xsl:variable>
	<xsl:variable name="TheSchema" select="document('AltusA30SM-Config-r100.xsd')"/>
	<xsl:variable name="LanguageSubfolder" select="Locale:LanguageSubfolder()"/>
	<xsl:variable name="ResourceFile" select="concat($LanguageSubfolder,'\\AltusA30SM-Resource-r100.xml')"/>
	<xsl:variable name="TheResources" select="document(string($ResourceFile))"></xsl:variable>

	<!-- Omit the system name -->
	<xsl:template match="SystemName"/>
	
	<!-- Omit the followiong... -->
	<xsl:template match="MinColumnHeaterTemp"/>
	<xsl:template match="MaxColumnHeaterTemp"/>
	<xsl:template match="WarnOnMissingVial"/>
	<xsl:template match="RequireEcord"/>
		
	<xsl:template match="/*">
		<xsl:element name="AltusA30SMConfig">
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>
	
	<!-- Do not emit these elements-->
	<xsl:template match="ElevatorCooler | Shuttle | Shutter | SampleHeaterCooler | ColumnHeaterCooler | ColumnHeater | DualAutosampler | ManualInjector | Robot | SwitchValve1 | SwitchValve2 | SwitchValve3 | SwitchValve4 | BarcodeReader | Plates | MeasuredLoopVolume | MeasuredNeedleVolume | MeasuredAirSensorVolume | UpperLeakSensorCalibration | BottomLeakSensorCalibration | MeasuredLoopVolumeNoPressure | MeasuredNeedleVolumeNoPressure | InstrumentType | 
TrappingValvePresent | AirSensorVolume">
	</xsl:template>
	
	<!-- Do not emit these elements-->
	<xsl:template match="DisableUpperLeakSensor | DisableBottomLeakSensor | SpotLight | ChamberLight | ElevatorAddress | ElevatorPresent | Autosampler1Present | Autosampler2Present">
	</xsl:template>
	
	<!-- Do not emit these elements-->
	<xsl:template match="ElevatorCoolerPresent | RobotPresent | ElevatorFirmwareVersion | ElevatorChecksum">
	</xsl:template>
	
	<xsl:template match="NeedleVolume">
		<xsl:call-template name="Emit"/>
	</xsl:template>

  <!-- Customize text for booleans -->
  <xsl:template match="Elevator">
    <xsl:variable name="varname">
      <xsl:value-of select="name()"/>
    </xsl:variable>
    <xsl:call-template name="Emit-Field-Value-Prompt">
      <xsl:with-param name="InputVar" select="$varname"/>
      <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='xsd:boolean']/Prompt[@id='Elevator']/@value"/>
      </xsl:with-param>
      <xsl:with-param name="InputUnits">None</xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="HasPreheater">
    <xsl:variable name="varname">
      <xsl:value-of select="name()"/>
    </xsl:variable>
    <xsl:call-template name="Emit-Field-Value-Prompt">
      <xsl:with-param name="InputVar" select="$varname"/>
      <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='xsd:boolean']/Prompt[@id='HasPreheater']/@value"/>
      </xsl:with-param>
      <xsl:with-param name="InputUnits">None</xsl:with-param>
    </xsl:call-template>
  </xsl:template>
  
  <!-- Emit elevator serial number only if elevator is present -->
	<xsl:template match="ElevatorSerialNumber">
		<xsl:variable name="ElevatorSN">
			<xsl:value-of select="."/>
		</xsl:variable>
		<xsl:if test="string-length($ElevatorSN)>0">
			<xsl:call-template name="Emit"/>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>

