Skip to content

header ​

Implementation level ​

TypeStatus
CML extraction template
HTML5 representation

Template attributes ​

AttributeValue
sourceQuantumEspresso log
idheader
nameProgram version
pattern^\s*Program\s*.*starts\son.*
endPattern.*
endOffset0
xml:baseinitialization/header.xml

Input ​

 Program PWSCF v.6.1 (svn rev. 13369) starts on 28Sep2017 at 18:37:43 

Output text ​

xml
<comment class="example.output" id="header">
        <module cmlx:templateRef="header">
             <scalar dataType="xsd:string" dictRef="cc:program">QuantumEspresso</scalar>
             <scalar dataType="xsd:string" dictRef="cc:module">PWSCF</scalar>
             <scalar dataType="xsd:string" dictRef="cc:programVersion">6.1</scalar>
             <scalar dataType="xsd:string" dictRef="cc:programSubversion">13369</scalar>
             <scalar dataType="xsd:date" dictRef="cc:rundate">2017-09-28T18:37:43.000+02:00</scalar>
        </module> 
    </comment>

Template definition ​

xml
<templateList>  <template id="header1" pattern="\s*Program.*\(svn.*\)\s*starts\s*on.*" endPattern=".*" endPattern2="~">    <record>\s*Program&#123;A,cc:module&#125;\s*v\.&#123;A,cc:programVersion&#125;\s\(svn\srev\.\s&#123;A,cc:programSubversion&#125;\)\sstarts\son&#123;X,x:date&#125;</record>      
        </template>  <template id="header2" pattern="\s*Program.*\s*starts\s*on.*">    <record>\s*Program&#123;A,cc:module&#125;\s*v\.&#123;A,cc:programVersion&#125;\s*starts\son&#123;X,x:date&#125;</record>
        </template>   
    </templateList>
<transform process="pullup" xpath=".//cml:scalar" repeat="3" />
<transform process="addChild" xpath="." elementName="cml:scalar" dictRef="cc:program" position="0" />
<transform process="setValue" xpath="./cml:scalar[@dictRef='cc:program']" value="QuantumEspresso" />
<transform process="setValue" xpath=".//cml:scalar[@dictRef='x:date']" value="$string(replace(replace(..//cml:scalar[@dictRef='x:date']/text(), 'at  ', 'at 0'), ': ', ':0'))" />
<transform process="createDate" xpath=".//cml:scalar[@dictRef='x:date']" format="ddMMMyyyy 'at' HH:mm:ss" />
<transform process="addAttribute" xpath=".//cml:scalar[@dictRef='cc:programVersion']" name="dataType" value="xsd:string" />
<transform process="addAttribute" xpath=".//cml:scalar[@dictRef='x:date']" name="dictRef" value="cc:rundate" />
<transform process="addAttribute" xpath=".//cml:scalar[@dictRef='cc:program']" name="dataType" value="xsd:string" />
<transform process="delete" xpath=".//cml:module" />
<transform process="delete" xpath=".//cml:list" />