<?xml version="1.0" encoding="UTF-8"?>
  <!-- PDS4 Schematron for Name Space Id:insight  Version:1.0.0.0 - Mon Nov 02 12:42:02 PST 2015 -->
  <!-- Generated from the PDS4 Information Model Version 1.5.0.0 - System Build 6a -->
  <!-- *** This PDS4 schematron file is an operational deliverable. *** -->
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">

  <sch:title>Schematron using XPath 2.0</sch:title>

  <sch:ns uri="http://pds.nasa.gov/pds4/pds/v1" prefix="pds"/>
  <sch:ns uri="http://pds.nasa.gov/pds4/mission/insight/v1" prefix="insight"/>

  <!-- jpadams - added manually -->
  <sch:ns uri="http://pds.nasa.gov/pds4/geom/v1" prefix="geom"/>
  <sch:ns uri="http://pds.nasa.gov/pds4/img/v1" prefix="img"/>

  <!-- ================================================ -->
  <!-- NOTE:  There are two types of schematron rules.  -->
  <!--        One type includes rules written for       -->
  <!--        specific situations. The other type are   -->
  <!--        generated to validate enumerated value    -->
  <!--        lists. These two types of rules have been -->
  <!--        merged together in the rules below.       -->
  <!-- ================================================ -->
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[1]"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[1]">
      <sch:assert test="geom:device_id = 'IDA' and geom:device_name = 'INSTRUMENT_DEPLOYMENT_ARM'"
        >
        insight:error:arm_state_1: For IDA Articulation_Device_Parameters class,
        geom:device_id must always be 'IDA' and geom:device_name must always be
        'INSTRUMENT_DEPLOYMENT_ARM' for Insight.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[1]">
      <sch:assert
        test="geom:selected_instrument_id = ('BLADE_1', 'BLADE_2', 'SCOOP', 'IDC', 'WRIST', 'GRAPPLE', 'GRAPPLE_ATTACH', 'SEIS', 'WTS', 'HP3', 'NOTOOL')"
        >
        insight:error:arm_state_2: For IDA Articulation_Device_Parameters class,
        geom:device_selected_id must be equal to one of the following values 'BLADE_1', 'BLADE_2',
        'SCOOP', 'IDC', 'WRIST', 'GRAPPLE', 'GRAPPLE_ATTACH', 'SEIS', 'WTS', 'HP3',
        'NOTOOL'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[1]">
      <sch:assert
        test="count(geom:Device_Angle) = 1 and count(geom:Device_Temperature) = 1 and count(geom:Vector_Device_Gravity) = 1"
        >
        insight:error:arm_state_3: When describing the IDA
        Articulation_Device_Parameters, geom:Device_Angle, geom:Device_Temperature, and
        geom:Vector_Device_Gravity sub-classes must exist.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Camera_Model_Parameters">
      <sch:assert test="geom:model_type = ('CAHV', 'CAHVOR', 'CAHVORE')"
        >
        insight:error:camera_model_0: geom:Camera_Model_Parameters.geom:model_type must
        be equal to one of the following values: 'CAHV', 'CAHVOR', 'CAHVORE'. </sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Command_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Command_Parameters">
      <sch:assert
        test="img:auto_exposure_data_cut &gt;= 0 and img:auto_exposure_data_cut &lt;= 4095"
        >
        insight:error:cmd_params_1: The attribute img:auto_exposure_data_cut must be within the value range 0-4095 inclusive.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Command_Parameters">
      <sch:assert test="img:shutter_correction_mode = ('true', 'false')"
        >
        insight:error:cmd_params_2: The attribute img:shutter_correction_mode must be equal to one of the following values: 'true', 'false'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Command_Parameters">
      <sch:assert
        test="img:exposure_duration_count &gt;= 0 and img:exposure_duration_count &lt;= 65535"
        >
        insight:error:cmd_params_3: The attribute img:exposure_duration_count must be within the value range 0-65535 inclusive.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Coordinate_Space_Definition">
      <sch:assert test="geom:positive_azimuth_direction = 'clockwise'"
        >
        insight:error:coord_space_0:
        In the Coordinate_Space_Definition class, the attribute positive_azimuth_direction must equal 'clockwise' .</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Coordinate_Space_Definition">
      <sch:assert test="geom:positive_elevation_direction = 'up'"
        >
        insight:error:coord_space_1:
        In the Coordinate_Space_Definition class, the attribute positive_elevation_direction must equal 'up'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Coordinate_Space_Definition/geom:Quaternion_1">
      <sch:assert test="geom:rotation_direction = 'Forward'"
        >
        insight:error:coord_space_2:
        The attribute geom:rotation_direction must equal 'Forward'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="//geom:Reference_Coordinate_Space/geom:Local_Internal_Reference">
      <sch:assert test="pds:local_reference_type = 'to_reference_coordinate_space'"
        >
        insight:error:coord_space_3:
        For all geom:Reference_Coordinate_Space/geom:Local_Internal_Reference, the local_reference_type must equal 'to_reference_coordinate_space'</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Data_Correction_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Data_Correction_Parameters">
      <sch:assert
        test="
          (img:geometry_projection_type = 'RAW' and substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 23, 1) = '_') or
          (img:geometry_projection_type = 'LINEARIZED' and substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 23, 1) = 'L')"
        >
        insight:error:data_corr_params_1: VICAR Product ID and img:geometry_projection_type mismatch. The geometry_projection_type must equal 'RAW' when the product ID specifies '_' in the 23rd position, and 'LINEARIZED' when an 'L' is specified.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Data_Correction_Parameters">
      <sch:assert test="img:shutter_correction_mode = ('true', 'false')"
        >
        insight:error:data_corr_params_2: The attribute img:shutter_correction_mode must be equal to one of the following values: 'true', 'false'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Downsample_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Downsample_Parameters">
      <sch:assert test="img:pixel_averaging_height = '1' and img:pixel_averaging_width = '1'"
        >
        insight:error:downsample_params_1: The attributes img:pixel_averaging_height and img:pixel_averaging_width must be equal to '1'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="/pds:Product_Observational/pds:File_Area_Observational/pds:File[1]">
      <sch:assert
        test="substring-before(pds:file_name, '.') = lower-case(//pds:Alias_List/pds:Alias[1]/pds:alternate_id)"
        >
        insight:error:file_area_0: The attribute pds.file_name should match the VICAR Product ID (pds:Alias/pds:alternate_id).</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[2]">
      <sch:assert test="geom:device_id = 'GRAPPLE' and geom:device_name = 'GRAPPLE'"
        >
        insight:error:grapple_state_0: When describing the GRAPPLE
        Articulation_Device_Parameters, geom:device_id must always be 'GRAPPLE' and geom:device_name
        must always be 'Grapple'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[2]">
      <sch:assert test="geom:device_mode = ('OPEN', 'BROKEN', 'IN_BETWEEN', 'CLOSED')"
        >
        insight:error:grapple_state_1: When describing the GRAPPLE
        Articulation_Device_Parameters, geom:device_mode must be equal to one of the following
        values: 'OPEN', 'BROKEN', 'IN_BETWEEN', 'CLOSED'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[2]">
      <sch:assert
        test="geom:device_phase = ('LAUNCH_LOCKED', 'STOWED', 'OK_TO_OPEN', 'SEIS_GRAPPLED', 'WTS_GRAPPLED', 'HP3_GRAPPLED')"
        >
        insight:error:grapple_state_2: When describing the GRAPPLE
        Articulation_Device_Parameters, geom:device_phase must be equal to one of the following
        values: 'LAUNCH_LOCKED', 'STOWED', 'OK_TO_OPEN', 'SEIS_GRAPPLED', 'WTS_GRAPPLED', 'HP3_GRAPPLED'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Articulation_Device_Parameters[2]">
      <sch:assert test="count(geom:Device_Temperature) = 1"
        >
        insight:error:grapple_state_3: The Grapple Articulation_Device_Parameters class should have exactly 1 Device_Temperature subclass.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="pds:Product_Observational/pds:Identification_Area"> </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="pds:Product_Observational/pds:Identification_Area">
      <sch:assert test="starts-with(pds:logical_identifier, 'urn:nasa:pds:insight_cameras:data')"
        >
        insight:error:ident_area_1: logical_identifier does not start with expected
        lid</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule context="pds:Product_Observational/pds:Identification_Area">
      <sch:assert
        test="pds:version_id = concat(substring(pds:Alias_List/pds:Alias[1]/pds:alternate_id, 35, 1), '.0')"
        >
        insight:error:ident_area_2: version_id does not match version specified by VICAR
        PRODUCT_ID</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert
        test="img:detector_to_image_rotation = '0.0' or img:detector_to_image_rotation = '270.0'"
        >
        insight:error:img_inst_params_1: The attribute img:detector_to_image_rotation must be equal to one of the following values: '0.0', '270.0'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert test="img:exposure_count &gt;= 0 and img:exposure_count &lt;= 65535"
        >
        insight:error:img_inst_params_2: The attribute img:exposure_count must be within the value range 0-65535 inclusive.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert
        test="img:exposure_duration_count &gt;= 0 and img:exposure_duration_count &lt;= 65535"
        >
        insight:error:img_inst_params_3: The attribute img:exposure_duration_count must be within the value range 0-65535.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert test="img:instrument_mode_id = 'FULL_FRAME'"
        >
        insight:error:img_inst_params_4: The attribute img:instrument_mode_id must be equal to 'FULL_FRAME'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert test="img:offset_mode_id &gt;= 0 and img:offset_mode_id &lt;= 4095"
        >
        insight:error:img_inst_params_5: The attribute img:offset_mode_id must be within the value range 0-4095.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters">
      <sch:assert test="img:sample_bit_method = ('NONE', 'SOFTWARE', 'SOFTWARE_INVERTED')"
        >
        insight:error:img_inst_params_6: The attribute img:sample_bit_method must be equal to one of the following values: 'NONE', 'SOFTWARE', 'SOFTWARE_INVERTED'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[2]"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[2]">
      <sch:assert
        test="
          (pds:name = 'Insight Deployment Camera' and substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 1, 1) = 'D') or
          (pds:name = 'Insight Context Camera' and substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 1, 1) = 'C')"
        >
        insight:error:inst_1: instrument name
        (pds:Observing_System_Component[2]/pds:name) does not match value specified in VICAR
        PRODUCT_ID (chars 0-1)</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[2]">
      <sch:assert
        test="
          (pds:name = 'Insight Deployment Camera' and pds:Internal_Reference/pds:lid_reference = 'urn:nasa:pds:context:instrument:idc.insight')
          or (pds:name = 'Insight Context Camera' and pds:Internal_Reference/pds:lid_reference = 'urn:nasa:pds:context:instrument:icc.insight')"
        >
        insight:error:inst_2: instrument name / LID reference mismatch. Permissible
        values: 'Insight Deployment Camera - urn:nasa:pds:context:instrument:idc.insight', 'Insight
        Context Camera - urn:nasa:pds:context:instrument:icc.insight' </sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[2]">
      <sch:assert test="pds:type = 'Instrument'"
        >
        insight:error:inst_3: instrument type
        (pds:Observing_System_Component[2]/pds:type) must always be 'Instrument'</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Instrument_Compression_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Instrument_Compression_Parameters">
      <sch:assert test="img:instrument_compression_name = ('NONE', 'JPEG')"
        >
        insight:error:inst_comprs_params_1: The attribute img:instrument_compression_name must be equal to one of the following values: 'NONE', 'JPEG'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Instrument_Compression_Parameters">
      <sch:assert
        test="img:instrument_compression_quality &gt;= 0 and img:instrument_compression_quality &lt;= 100"
        >
        insight:error:inst_comprs_params_2: The attribute img:instrument_compression_quality must be within the range 0-100.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Instrument_Device_Temperature"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Instrument_Device_Temperature">
      <sch:assert test="count(img:Instrument_Device_Temperature_Index) = 2"
        >
        insight:error:inst_device_temp_1: The class img:Instrument_Device_Temperature must have exactly 2 img:Instrument_Device_Temperature_Index subclasses.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Imaging_Instrument_Parameters/img:Instrument_Device_Temperature">
      <sch:assert
        test="(img:Instrument_Device_Temperature_Index[1]/img:name = 'IDC_CCD' and img:Instrument_Device_Temperature_Index[2]/img:name = 'IDC_ELECTRONICS') or (img:Instrument_Device_Temperature_Index[1]/img:name = 'ICC_CCD' and img:Instrument_Device_Temperature_Index[2]/img:name = 'ICC_ELECTRONICS')"
        >
        insight:error:inst_device_temp_2: The img:name values for the Instrument_Device_Temperature_Index classes must be either combination of 'IDC_CCD' and 'IDC_ELECTRONICS' or  'ICC_CCD' and 'ICC_ELECTRONICS'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[1]"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[1]">
      <sch:assert test="pds:name = 'Insight Lander'"
        >
        insight:error:insthost_1: instrument host name must always be 'Insight
        Lander'</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[1]">
      <sch:assert test="pds:type = 'Spacecraft'"
        >
        insight:error:insthost_2: instrument host type must always be
        'Spacecraft'</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Observing_System/pds:Observing_System_Component[1]">
      <sch:assert
        test="pds:Internal_Reference/pds:lid_reference = 'urn:nasa:pds:context:instrument_host:spacecraft.insight'"
        >
        insight:error:insthost_3: instrument host lid_reference must always be
        'urn:nasa:pds:context:instrument_host:spacecraft.insight'</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Mission_Area/insight:Observation_Information">
      <sch:assert
        test="(insight:mission_phase_name != 'TEST' and insight:sol_number = substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 6, 4)) or (insight:mission_phase_name = 'TEST')"
        >
        insight: sol_number does not match value specified in VICAR PRODUCT_ID (chars 6-9)</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Mission_Area/insight:Observation_Information"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Mission_Area/insight:Observation_Information">
      <sch:assert
        test="substring-before(insight:spacecraft_clock_start_count, '.') = substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 11, 9)"
        >
        insight:error:mission_area_1: spacecraft_clock_start_count does not match value
        specified in VICAR PRODUCT_ID (chars 11-19)</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander">
      <sch:assert
        test="count(geom:Motion_Counter) = 1 and count(geom:Motion_Counter/geom:Motion_Counter_Index) = 1"
        >
        insight:error:motion_counter_0: There must only be exactly 1 geom:Motion_Counter class with exactly 1 geom:Motion_Counter_Index subclass.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Motion_Counter">
      <sch:assert test="geom:name = 'RMC'"
        >
        insight:error:motion_counter_1: The attribute geom:Motion_Counter/geom:name must always equal 'RMC'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Motion_Counter/geom:Motion_Counter_Index">
      <sch:assert test="geom:index_name = 'SITE' and geom:index_value_number = '1'"
        >
        insight:error:motion_counter_2: The attribute geom:index_name must equal 'SITE' and geom:index_value_number must equal '1'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Processing_History"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Processing_History/img:Process/img:Process_Owner">
      <sch:assert
        test="
          (img:product_producer_institution_name = 'MULTIMISSION IMAGE PROCESSING SUBSYSTEM, JET PROPULSION LAB' and substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 34, 1) = 'M') or
          substring(//pds:Alias_List/pds:Alias[1]/pds:alternate_id, 34, 1) = '_'"
        >
        insight:error:proc_hist_1: VICAR Product ID and img:product_producer_institution_name mismatch. img:product_producer_institution_name must equal 'MULTIMISSION IMAGE PROCESSING SUBSYSTEM, JET PROPULSION LAB' when product ID specifies 'M' in 35th position.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Product_Identification"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/geom:Geometry/geom:Geometry_Lander/geom:Coordinate_Space_Definition/geom:Present_Coordinate_Space/geom:Coordinate_Space_Indexed">
      <sch:assert
        test="geom:Coordinate_Space_Index[1]/geom:index_name = 'SITE' and geom:Coordinate_Space_Index[1]/geom:index_value_number = '1'"
        >
        insight:error:site_check_0:
        Insight must always coordinate space index_name = 'SITE' and index_value = '1'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Product_Identification/img:Original_Source_Products/img:Source_Product"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Product_Identification/img:Original_Source_Products/img:Source_Product">
      <sch:assert
        test="(substring(tokenize(img:Internal_Reference/pds:lid_reference, ':')[last()], 20, 3) = 'edr' or substring(tokenize(img:Internal_Reference/pds:lid_reference, ':')[last()], 20, 3) = 'erp') and img:Internal_Reference/pds:reference_type = 'data_to_raw_product'"
        >
        insight:error:src_prods_1: img:Source_Product lid_reference and reference_type mismatch. If lid_reference refers to an EDR, then reference_type must be equal to 'data_to_raw_product'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Subframe_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Subframe_Parameters">
      <sch:assert test="img:first_line = '1' and img:first_sample = '1'"
        >
        insight:error:subframe_params_1: The attributes img:first_line and img:first_sample must each have values equal to '1'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters"
    > </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert test="img:download_priority &gt;= 1 and img:download_priority &lt;= 6"
        >
        insight:error:tlm_params_1: The attribute img:download_priority must be within the range 1-6 inclusive.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert test="img:product_completion_status = ('PARTIAL', 'COMPLETE')"
        >
        insight:error:tlm_params_2: The attribute img:product_completion_status must be equal to one of the following values: 'PARTIAL', 'COMPLETE'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert
        test="img:telemetry_application_id &gt;= 126 and img:telemetry_application_id &lt;= 139"
        >
        insight:error:tlm_params_3: The attribute img:download_priority must be within the range 126-139 inclusive.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert
        test="img:telemetry_application_name = ('ICC_1', 'ICC_2', 'ICC_3', 'ICC_4', 'ICC_5', 'ICC_6', 'ICC_UNRECOG', 'IDC_1', 'IDC_2', 'IDC_3', 'IDC_4', 'IDC_5', 'IDC_6', 'IDC_UNRECOG')"
        >
        insight:error:tlm_params_4: The attribute img:telemetry_application_name must be equal to one of the following values: 'ICC_1', 'ICC_2', 'ICC_3', 'ICC_4', 'ICC_5', 'ICC_6', 'ICC_UNRECOG', 'IDC_1', 'IDC_2', 'IDC_3', 'IDC_4', 'IDC_5', 'IDC_6', 'IDC_UNRECOG'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert test="img:telemetry_provider_id = 'TTACS'"
        >
        insight:error:tlm_params_5: The attribute img:telemetry_provider_id must be equal to 'TTACS'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:rule
      context="/pds:Product_Observational/pds:Observation_Area/pds:Discipline_Area/img:Telemetry_Parameters">
      <sch:assert test="img:telemetry_transport_protocol = 'SFDU'"
        >
        insight:error:tlm_params_6: The attribute img:telemetry_transport_protocol must be equal to 'SFDU'.</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>
