Please read about metadata naming convention here:
http://www.brockmann-consult.de/beam-wiki/display/BEAM/GPT+and+Velocity
section: State 2 - Metadata files
section: State 3 - Source metadata files
section: State 6 - Velocity templates

Please refer also to the usage of the MetadataEngine.

VELOCITY TEMPLATES
----------------------

Example 1:
  <processStep>
      <software>
          <name>$commandLineArgs.get(0)</name>
          <version>$commandLineArgs.get(1)</version>
      </software>
      <dem>$commandLineArgs.get(2)</dem>
      <source>
          <sourceProduct>$sourcePaths.get("source")</sourceProduct>
          <metadata>$sourceMetadata.get("source").get("metadata_xml").content</metadata>
      </source>
  </processStep>

Example 2:
      $commandLineArgs.get(0) $commandLineArgs.get(1).
      $metadataXX.getContent().
      Output item path: $targetPath.
      The source metadata:
      1) $sourceMetadata.get("source1").get("metadata_txt").content
      2) $sourceMetadata.get("source2").get("blubber_xm").content
      3) $sourceMetadata.get("source3").get("report_txt").content
      4) $sourceMetadata.get("source3").get("report_xml").content.
      A source path: $sourcePaths.get("source1").

Example 3:
      <metadata>
          <sources>
              #foreach ($sourcePath in $sourcePaths)
                  <source>$sourcePath</source>
              #end
          </sources>
          <target>$targetPath</target>
          <additional>$commandLineArgs.get(0) $commandLineArgs.get(1)</additional>
      </metadata>


Command line for Example 1:
java -cp "$classPath" com.bc.ceres.standalone.MetadataEngineMain
                -v template1=/home/userx/velocity/metadata.xml.vm
                -S source=$inputpath
                -t $metadataOutputPath
                $software $amorgosVersion $(basename $demdir)

Command line for Example 2 and 3:
String[] args = {"-m", "/my/metadataXX.properties",
                "-v", "template1=/my-template.xml.vm", "-v", "template2=/yours.txt.vm",
                "-S", "source1=source/path/tsm-1.dim", "-S", "source2=source/path/tsm-2.N1", "-S", "source3=source/path/tsm-3.hdf",
                "-t", "/my/chl-a.N1",
                "Hello", "world"};

ANOTHER COMMAND LINE EXAMPLE:
-----------------------------
metadata-engine.bat -m "metadata=C:\Software-Tests\ceres-metadata\data\resource\resource.xml" -m "lut=C:\Software-Tests\ceres-metadata\data\lut\resource.properties" -t "C:\Software-Tests\ceres-metadata\data\out" -v "template=C:\Software-Tests\ceres-metadata\data\template\product-data-sheet.html.vm"

resource.xml:
[..]
            <gmd:spatialResolution>
                <gmd:MD_Resolution>
                    <gmd:distance>
                        <gco:Distance uom="m">1000</gco:Distance>
                    </gmd:distance>
                </gmd:MD_Resolution>
            </gmd:spatialResolution>
[..]
                   <gmd:temporalElement>
                        <gmd:EX_TemporalExtent>
                            <gmd:extent>
                                <gml:TimePeriod gml:id="IDcd3b1c4f-b5f7-439a-afc4-3317a4cd89be" xsi:type="gml:TimePeriodType">
                                    <gml:beginPosition>2009-06-26T09:59:14</gml:beginPosition>
                                    <gml:endPosition>2009-06-26T09:59:14</gml:endPosition>
                                </gml:TimePeriod>
                            </gmd:extent>
                        </gmd:EX_TemporalExtent>
                    </gmd:temporalElement>
                </gmd:EX_Extent>
            </gmd:extent>
        </gmd:MD_DataIdentification>
    </gmd:identificationInfo>

[..]

resource.properties
[..]
4326 = GEOGCS["WGS84(DD)"]
[..]

product-data-sheet.html.vm:
#set( $startDate = $xpath.run("//identificationInfo/MD_DataIdentification/extent/EX_Extent/temporalElement/EX_TemporalExtent/extent/TimePeriod/beginPosition", $metadata) )
[..]
<table>
    <tr>
        <td>Spatial Resolution:</td>
        <td>
            $xpath.run("//MD_Resolution/distance/Distance", $metadata) $xpath.run("//MD_Resolution/distance/Distance/@uom", $metadata)
            -> result: 1000 m
        </td>
    </tr>
    <tr>
        <td>EPSG Code:</td>
        <td>
            $lut.map.get($epgsCode)
            -> result: GEOGCS["WGS84(DD)"]
        </td>
    </tr>
</table>
<table>
    <tr>
        <td>Acquisition Date:</td>
        <td>
            $dateFormat.format($dateFormat.parse($startDate))
            -> result: 2009-06-26
        </td>
    </tr>
</table>
[..]