[GRASS-SVN] r61461 - in sandbox/krejcmat/src: . templates

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 30 08:17:02 PDT 2014


Author: krejcmat
Date: 2014-07-30 08:17:01 -0700 (Wed, 30 Jul 2014)
New Revision: 61461

Modified:
   sandbox/krejcmat/src/editor3.py
   sandbox/krejcmat/src/g.gui.metadata.py
   sandbox/krejcmat/src/jinjainfo.py
   sandbox/krejcmat/src/templates/grassGRASSTemplateFinal.xml
   sandbox/krejcmat/src/templates/grassInspireTemplateFinal.xml
Log:
g.gui.metadata - template creator

Modified: sandbox/krejcmat/src/editor3.py
===================================================================
--- sandbox/krejcmat/src/editor3.py	2014-07-30 15:06:54 UTC (rev 61460)
+++ sandbox/krejcmat/src/editor3.py	2014-07-30 15:17:01 UTC (rev 61461)
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+# -*- coding: utf-8
 import wx
 from wx import ID_ANY
 from wx import EVT_BUTTON
@@ -20,6 +22,7 @@
 import logging
 from core.gcmd import RunCommand, GError, GMessage
 import sys
+from wx.lib.analogclock.lib_setup.buttontreectrlpanel import EVT_CHANGED
 
 
 #=========================================================================
@@ -30,15 +33,20 @@
     def __init__(self, pathToXml=None):
         self.path = pathToXml
         self.owslibInfo = None
-        # self.readXML()
 
     def initMD(self, path=None):
-       #print path
         if path is None:
             self.md = MD_Metadata(md=None)
-               
             return self.md
         else:
+            io=open(path,'r')
+            str1=''
+            for line in io.readlines():
+                str1+=self._removeNonAscii(line)
+            io.close()
+            io1=open(path,'w')
+            io1.write(str1)
+            io1.close()    
             
             try:
                 tree = ET.parse(path)
@@ -46,15 +54,18 @@
                 self.md = MD_Metadata(root)
                 return self.md
             except  Exception, e:
-                ##print e
-                
                 GError('Error loading xml:\n'+str(e))
                 
-         
-    def saveToXML(self, md, jinjaPath, outPath=None, xmlOutName=None):
-                # if  output file name is None, use map name and add postfix
+    def _removeNonAscii(self,s): 
+        s= filter(lambda x: x in string.printable, s)
+        return s
+    
+                
+    def saveToXML(self, md,owsTagList, jinjaPath, outPath=None, xmlOutName=None):
+         # if  output file name is None, use map name and add postfix
         self.dirpath = os.path.dirname(os.path.realpath(__file__))
         self.md = md
+        self.owsTagList=owsTagList
         
         if xmlOutName is None:
             xmlOutName = 'RANDExportMD'  # TODO change to name of map
@@ -66,35 +77,49 @@
             outPath = os.path.join(self.dirpath, xmlOutName)
         else:
             outPath = os.path.join(outPath, xmlOutName)
-
+        #print jinjaPath
+        xml=open(jinjaPath,'r')
+        
+        str1=''
+        for line in xml.readlines():
+            line=self._removeNonAscii(line)
+            str1+=line
+        xml.close
+        io=open(jinjaPath,'w')
+        io.write(str1)
+        io.close()
+        
+        #=======================================================================
+        # jinjaPath=jinjaPath.replace('.xml','A.xml')
+        # xmlN=open(jinjaPath,'w')
+        # xmlN.write(str1)
+        # xmlN.close()
+        #=======================================================================
+        #GMessage('brak')
         # generate xml using jinja tempaltes
-       #print jinjaPath
         head, tail = os.path.split(jinjaPath)
         env = Environment(loader=FileSystemLoader(head))
         env.globals.update(zip=zip)
         template = env.get_template(tail)
-        iso_xml = template.render(md=self.md)
+        if self.owsTagList is None:
+            iso_xml = template.render(md=self.md)
+        else:
+           #print"template.render(md=self.md,owsTagList=self.owsTagList)---"
+            iso_xml = template.render(md=self.md,owsTagList=self.owsTagList)
         xml_file = xmlOutName
 
-        # write xml to flat file
         try:
-           #print '*'*100
-           #print 'saveToXML'
             xml_file = open(outPath, "w")
             xml_file.write(iso_xml)
             xml_file.close()
-            #print 'metadata exported: \n%s' % (str(outPath))
-
+            GMessage('File exported to: %s'% outPath)
         except  Exception, e:
-                GError('Error loading xml:\n'+str(e))
-                sys.exit()
+                GError('Error writing xml:\n'+str(e))
         return outPath
 
 #=========================================================================
 # CREATE BOX (staticbox+button(optional)
 #=========================================================================
-
-
 class MdBox(wx.Panel):
 
     def __init__(self, parent, label='label'):
@@ -180,10 +205,15 @@
 
     def removeMdItem(self, mdDes, items):
         mdDes.mdDescription.removeMdItem(mdDes)
+        #self.stBoxSizer.Remove(mdDes)
+        #self.stbox.Refresh()
         for item in items:
             item.Destroy()
-        # self.SetSizerAndFit(self.panelSizer)
-        # self.SetSizerAndFit(self.stBoxSizer)
+        #mdDes.Destroy()
+        #self.panelSizer.Fit()
+        #self.SetSizerAndFit(self.panelSizer)
+        
+        #self.SetSizerAndFit(self.stBoxSizer)
 
     def duplicateBox(self, evt):
         parent = self.GetParent()
@@ -281,10 +311,10 @@
 
 class MdItem(wx.BoxSizer):
 
-    def __init__(self,parent,item,multiplicity=None,rmMulti=False,isFirstNum=-1):
+    def __init__(self,parent,item,multiplicity=None,rmMulti=False,isFirstNum=-1,chckBox=False):
         wx.BoxSizer.__init__(self, wx.VERTICAL)
         self.isValid=False
-        
+        self.isChecked=False
         self.mdDescription = item
 
         if multiplicity is None:
@@ -305,7 +335,6 @@
                                          wx.TE_MULTILINE  | wx.TE_WORDWRAP |
                                          wx.TAB_TRAVERSAL | wx.RAISED_BORDER )
         else:
-
             self.valueCtrl = wx.TextCtrl(parent, id=wx.ID_ANY,
                                          # validator=MyValidator('ALPHA_ONLY'),
                                          style=wx.VSCROLL | wx.TE_DONTWRAP |
@@ -321,14 +350,26 @@
         if rmMulti:
             self.rmItemButt = wx.Button(parent, -1, size=(30, 30), label='-')
             self.rmItemButt.Bind(EVT_BUTTON, self.removeItem)
+            
+        if chckBox:
+            
+            self.chckBox=wx.CheckBox(parent, -1, size=(30, 30))
+            self.chckBox.Bind(wx.EVT_CHECKBOX,self.onChangeChckBox)
+            self.chckBox.SetValue(True)
+            self.isChecked=True
+            self.valueCtrl.Disable()
         
+        self.createInfo()
+        self.tip = wx.ToolTip(self.infoTip)
+        self._addItemLay(item.multiline, rmMulti,chckBox)
         
-        #self.valueCtrl.Bind(wx.EVT_ACTIVATE, )
+    def onChangeChckBox(self,evt):
+        self.isChecked=self.chckBox.GetValue()
+        if self.isChecked:
+            self.valueCtrl.Disable()
+        else:
+            self.valueCtrl.Enable()
         
-        self.createInfo()
-        self.tip = wx.ToolTip(self.infoTip)
-        self._addItemLay(item.multiline, rmMulti)
-
     def onMove(self, evt=None):
         self.valueCtrl.SetToolTip(self.tip)
 
@@ -347,11 +388,10 @@
         string += '- -'*30 + '\n'    
         if self.mdDescription.statements is not None:     
             string += 'Jinja template info: \n' + self.mdDescription.statements + '\n'
-        else:
-            string += 'OWSLib info:\n' + self.mdDescription.tag 
+            
         if self.mdDescription.statements1 is not None:     
             string +=  self.mdDescription.statements1 + '\n'   
-                 
+        string += 'OWSLib info:\n' + self.mdDescription.tag          
         self.infoTip = string
 
     def removeItem(self, evt):
@@ -361,9 +401,14 @@
             list.append(self.rmItemButt)
         except:
             pass
+        try:
+            list.append(self.chckBox)
 
+        except:
+            pass
         self.valueCtrl.GetParent().removeMdItem(self, list)
-
+        #self.SetSizerAndFit(self.panelSizer)
+        
     def duplicateItem(self, evt):
         '''add Md item to parent(box or notebook page)
         '''
@@ -398,9 +443,14 @@
             value=value.replace("'",'')
             self.isValid=True
             self.valueCtrl.SetValue(value)
-
+            
+    def _removeNonAscii(self,s): 
+        s= filter(lambda x: x in string.printable, s)
+        return s
+    
     def getValue(self):
-        return self.valueCtrl.GetValue()
+        
+        return self._removeNonAscii(self.valueCtrl.GetValue())
 
     def getCtrlID(self):
         return self.valueCtrl.GetId()
@@ -411,30 +461,25 @@
         else:
             return None
 
-    def _addItemLay(self, multiline, rmMulti):
-
+    def _addItemLay(self, multiline, rmMulti, chckBox):
+        self.textFieldSizer = wx.BoxSizer(wx.HORIZONTAL)
         if multiline is True:
-            self.textFieldSizer = wx.BoxSizer(wx.HORIZONTAL)
-            self.textFieldSizer.Add(
-                self.valueCtrl,
-                proportion=1,
-                flag=wx.EXPAND)
-            if self.multiple:
-                self.textFieldSizer.Add(self.addItemButt, 0)
-            if rmMulti:
-                self.textFieldSizer.Add(self.rmItemButt, 0)
-            self.Add(item=self.tagText, proportion=0)
-            self.Add(item=self.textFieldSizer, proportion=0, flag=wx.EXPAND)
-
+            self.textFieldSizer.Add(self.valueCtrl,proportion=1,flag=wx.EXPAND)
         else:
-            self.textFieldSizer = wx.BoxSizer(wx.HORIZONTAL)
             self.textFieldSizer.Add(self.valueCtrl, proportion=1)
-            if self.multiple:
+        
+        if self.multiple:
                 self.textFieldSizer.Add(self.addItemButt, 0)
-            if rmMulti:
+        if rmMulti:
                 self.textFieldSizer.Add(self.rmItemButt, 0)
-            self.Add(item=self.tagText, proportion=0)
-            self.Add(item=self.textFieldSizer, proportion=0, flag=wx.EXPAND)
+                
+        if chckBox:
+                self.textFieldSizer.Add(self.chckBox, 0)
+                
+        self.Add(item=self.tagText, proportion=0)
+        self.Add(item=self.textFieldSizer, proportion=0, flag=wx.EXPAND)
+            
+        
 
 
 #=========================================================================
@@ -493,6 +538,7 @@
         mdDes.mdDescription.removeMdItem(mdDes)
         for item in items:
             item.Destroy()
+        #mdDes.Destroy()
         self.SetSizerAndFit(self.mainSizer)
 
     #===========================================================================
@@ -534,13 +580,13 @@
 
 class MdMainFrame(wx.Panel):
 
-    def __init__(self, parent, templpatePath, mdISOXML):
+    def __init__(self, parent, templpatePath, mdISOXML,templateEditor=False):
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
         # self.SetMinSize(500,500)
 
         self.mdo = MdFileWork()
         self.md = self.mdo.initMD(mdISOXML)
-
+        self.templateEditor=templateEditor
         self.templatePath = templpatePath
         # self.templatePath='data/jinjatest.xml'
 
@@ -556,7 +602,7 @@
 
 #----------------------------------------------------------- GUI GENERATOR START
     def executeStr(self, stri, linfo):
-       #print stri
+        #print stri
         exec stri
 
     def plusC(self, num=None):
@@ -611,13 +657,20 @@
             if not '\t'in staTMP:
                 tab='\t'
                 tab1=''
+                staTMP=staTMP+":\n"+tab+'self.isValidS=True'
             else:
-                tab='\t\t' 
+                tab='\t' 
                 tab1='\t'  
+                staTMP=staTMP.replace('\t','')+":\n"+tab+'self.isValidS=True'
+           
+            #print staTMP
+            try:#if loop for in for
+                self.executeStr(staTMP, False)
+            except:
+                staTMP=self.staTMP.replace('self.isValidS=True','')+'\n\t'+ staTMP.replace('\t','\t\t')
+                self.executeStr(staTMP, False)
                 
-            staTMP=staTMP+":\n"+tab+'self.isValidS=True'
-            self.executeStr(staTMP, False)
-            ##print 'is valid===',self.isValidS
+            self.staTMP=    staTMP
             if self.isValidS:
                 return sta
             else:
@@ -633,8 +686,8 @@
             statements = lstruct[self.c - 1]
             if 'if' in statements.split():
                 IFStatements = True
-                
-            looptmp=chckIfStetementsFORisValid(statements.replace(' md.', ' self.md.'))    
+            loop=statements.replace(' md.', ' self.md.')
+            looptmp=chckIfStetementsFORisValid(loop)    
             str2 = 'numOfSameBox=0\n'
             str2 += looptmp
     
@@ -645,30 +698,33 @@
 
             box = False
             if self.mdDescription[self.c].inbox:
+                
                 box = True
                 str2 += '\t' + \
                     'box=MdBox(self.nbPage,linfo[' + str(self.c) + '].inbox)\n'  # add box
+                    
             str1 = str2
             itemCounter=1
+            
             while '\t' in lstruct[self.c] and self.stop is False:
                 itemCounter+=1
+                
                 if  'for' not in str(lstruct[self.c]).split()\
                           and 'if' not in str(lstruct[self.c]).split():
                    
                     value = str(self.mdOWSTagStrList[self.c])
                     str1 += '\t' + \
-                        'self.mdDescription[' + str(self.c) + '].addStatements("' + looptmp + '")\n'
+                        'self.mdDescription[' + str(self.c) + "].addStatements('" + loop + "')\n"
 
-
                     if box:
                         str1 += '\t' + \
-                            'it=MdItem(parent=box,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameBox)\n'
+                            'it=MdItem(parent=box,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameBox,chckBox=self.templateEditor)\n'
                     else:
                         str1 += '\t' + \
-                            'it=MdItem(parent=self.nbPage,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameBox)\n'
+                            'it=MdItem(parent=self.nbPage,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameBox,chckBox=self.templateEditor)\n'
+                            
                     if self.isValidS: #if metatdata are loaded to owslib
                         if IFStatements:
-                            
                             str1 += '\t' + 'it.setValue(self.' + str(value) + ')\n'
                         else:
                             str1 += '\t' + 'it.setValue(' + str(value) + ')\n'
@@ -677,6 +733,7 @@
                             str1 += '\t' + 'it.setValue("$NULL")\n'
                         else:
                             str1 += '\t' + 'it.setValue("$NULL")\n'
+                            
                     str1 += '\t' + \
                         'self.mdDescription[' + str(self.c) + '].addMdItem(it)\n'
                     str1 += '\t' + 'self.ItemList.append(it)\n'
@@ -687,13 +744,15 @@
                     statements = lstruct[self.c]
                     str2 = ''
                     keyword = False
+                    
                     if '["keywords"]' in statements:
                         keyword = True
                         str2 += '\t' + 'self.keywordsList=[]\n'
 
                     str2 += '\t' + 'numOfSameItem=0\n'
-                    looptmp1 = statements.replace(' md.', ' self.md.')
-                    #looptmp1=chckIfStetementsFORisValid(looptmp1)
+                    loop2=statements.replace(' md.', ' self.md.') 
+                    looptmp1=chckIfStetementsFORisValid(loop2)
+                    #print '============'*5
                     str2 += looptmp1 + ':\n'
                     self.plusC()
                     str1 += str2
@@ -704,20 +763,23 @@
                         # save information about loops
                         str1 += '\t\t' + 'numOfSameItem+=1\n'
                         str1 += '\t\t' + \
-                            'self.mdDescription[' + str(self.c) + "].addStatements('" + looptmp + "')\n"
+                            'self.mdDescription[' + str(self.c) + "].addStatements('" + loop + "')\n"
                         str1 += '\t\t' + \
-                            'self.mdDescription[' + str(self.c) + "].addStatements1('" + looptmp1 + "')\n"
+                            'self.mdDescription[' + str(self.c) + "].addStatements1('" + loop2 + "')\n"
 
                         if box:
                             str1 += '\t\t' + \
-                                'it=MdItem(parent=box,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameItem)\n'
+                                'it=MdItem(parent=box,item=linfo[' + str(self.c) + '],isFirstNum=numOfSameItem,chckBox=self.templateEditor)\n'
+                                
                         else:
                             str1 += '\t\t' + \
-                                'it=MdItem(self.nbPage,linfo[' + str(self.c) + '],isFirstNum=numOfSameItem)\n'
+                                'it=MdItem(self.nbPage,linfo[' + str(self.c) + '],isFirstNum=numOfSameItem,chckBox=self.templateEditor)\n'
+                                
                         if self.isValidS:         
-                            str1 += '\t\t' + 'it.setValue(' + str(value) + ')\n'
+                            str1 += '\t\t' + 'it.setValue(' + str(value) + ')\n'    
                         else:
                             str1 += '\t\t' + 'it.setValue("$NULL")\n'
+                            
                         str1 += '\t\t' + 'self.ItemList.append(it)\n'
 
                         if keyword:
@@ -740,12 +802,8 @@
             else:
                 str1 += tab + 'self.nbPage.addItem(self.ItemList)\n'
 
-            #str1 += tab + 'self.plusC()\n'
             self.executeStr(str1, linfo)
-            ##print 'item counter-',itemCounter            
-            #self.minusC(itemCounter)
-            
-            #print 'c--po plus' , self.c
+
 #--------------------------------------------------------------------- INIT VARS
         self.notebook = wx.Notebook(self)
         markgroup = []  # notebok panel marker
@@ -769,9 +827,7 @@
                 self.notebokDict[linfo[self.c].group]=self.nbPage
             else:
                 self.nbPage=self.notebokDict[linfo[self.c].group]
-            
-            
-            
+
             # if starting the statements
             if '\t' in lstruct[self.c]and self.stop is False:
                 #print '-'*50
@@ -781,13 +837,16 @@
             elif 'for' not in str(lstruct[self.c]).split() and 'if' not in str(lstruct[self.c]).split():
                 #print '-'*50
 
-                it = MdItem(self.nbPage, linfo[self.c])
+                it = MdItem(parent=self.nbPage, item=linfo[self.c],chckBox=self.templateEditor)
                 ##print 'hodnota--', linfo[self.c].tag 
                 value = 'self.' + \
                     str(self.mdOWSTagStrList[self.c]).replace('\n', '')
-                ##print value
                 
-                it.setValue(eval(value))
+                
+                value = eval(value)
+                if value is None:
+                    value=''
+                it.setValue(value)
 
                 self.mdDescription[self.c].addMdItem(it)
                 self.nbPage.addItem(it)
@@ -795,44 +854,129 @@
                 #print '-'*50
             else:
                 self.plusC()
-        
-
-        
-                 
-        self.md = MD_Metadata()
-        
-        
-        
+      
+   
 #----------------------------------------------------------- GUI GENERATOR END
 
-#------------------------------------------------------------------------ LAYOUT
-    def _layout(self):
-        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
-        self.SetSizer(self.mainSizer)
+    def defineTemplate(self):
 
-        noteSizer = wx.BoxSizer(wx.VERTICAL)
-        self.notebook.SetSizer(noteSizer)
-        self.mainSizer.Add(self.notebook, proportion=1, flag=wx.EXPAND)
-        self.Show()
+        try:
+            template=open(self.templatePath,'r')
+        except  Exception, e:              
+            GError('Error loading template:\n'+str(e))              
+        owsTagList=list()  
+        indexowsTagList=0
+        finalTemplate=''
+        chcked=False
+        forST=0
+        ifST=0
+        forSTS=False
+        ifSTS=False     
+                     
+        for line in template.readlines():    
+            if '{% for' in line:
+               #print'===='*50
+               #printline  
+                forSTS=True
+                forST+=1 
+               #print'for ----', forST
+               #print'===='*50     
+            if '{% if' in line:
+                #print'===='*50
+                 ifSTS=True
+                 ifST+=1    
+                #print'if ----', ifST
+                #print'===='*50   
+                          
+            for r,item in enumerate(self.mdDescription):   
+                str1=item.selfInfoString  
+                if str1 in line:            #owslib definition in line            
+                    try:
+                        if item.mdItem[0].isChecked==True:
+                            chcked=True
+                    except:
+                        try:
+                            if self.mdDescription[r+1].mdItem[0].isChecked==True:
+                                chcked=True
+                        except:
+                            try:
+                                if self.mdDescription[r+2].mdItem[0].isChecked==True:
+                                    chcked=True
+                            except :  
+                                try:
+                                    if self.mdDescription[r+3].mdItem[0].isChecked==True:
+                                        chcked=True
+                                except:
+                                    pass
+                    if chcked:      #chckbox in gui
+                        #print 'if chcked-----'
+                        if forSTS:
+                            forSTS=False
+                            forST-=1
+                        if ifSTS:
+                            ifSTS=False
+                            ifST-=1
+                        
+                        #print str1
+                        owsTagList.append(str1)
+                        templateStr= '{{ owsTagList['+str(indexowsTagList)+'] }}'
+                        indexowsTagList+=1
+                        finalTemplate+=line.replace(str1,templateStr) 
+                        continue 
 
-    #=========================================================================
-    # def #printmd(self):
-    #     for item in self.mdDescription:
-    #         #print item.tag
-    #         #print item.name
-    #         #print item.mdItem
-    #         #print '-----'
-    #=========================================================================
+            if chcked==False:                        
+                    if '{% endfor -%}' in line and forST==0:
+                       #print'===='*50
+                       #print'{% endfor -%}'
+                       #printstr1
+                       #printline
+                        
+                       #print'===='*50
+                        str1='{% endfor -%}'
+                        owsTagList.append(str1)
+                        templateStr= '{{ owsTagList['+str(indexowsTagList)+'] }}'
+                        indexowsTagList+=1
+                        finalTemplate+=line.replace(str1,templateStr) 
+                        #forST-=1  
+                                                      
+                    elif '{% endif -%}' in line and ifSTS==0:
+                       #print'===='*50
+                       #printstr1
+                       #printline
+                       #print'{% endif -%}'
+                       #print'===='*50 
+                        str1= '{% endif -%}'
+                        owsTagList.append(str1)
+                        templateStr= '{{ owsTagList['+str(indexowsTagList)+'] }}'
+                        indexowsTagList+=1
+                        finalTemplate+=line.replace(str1,templateStr)
+                        #ifSTS-=1        
+                                     
+                    else:
+                        finalTemplate+=line
+                        
+            chcked=False    
+                #print line 
+                #print '-*****----****----'
+                    
+                   
+        head, tail = os.path.split(self.templatePath)
+        tail='EXPT'+tail
+        self.templatePath=os.path.join(head,tail)
+        templateOut=open(self.templatePath,'w')
+        templateOut.write(finalTemplate)
+        templateOut.close()
+       ##print'defineTemplate 4'
+        #print finalTemplate 
+        #print self.templatePath
+        return owsTagList    
+     
+#----------------------------------------- FILL OWSLib BY EDITED METADATA IN GUI
 
     def executeStr1(self, stri, item):
        #print stri
         exec stri
 
-    def exportToXml(self, jinjaPath, outPath, xmlOutName):
-        #print '=' * 50
-        self.createNewMD()
-        self.mdo.saveToXML(self.md, jinjaPath, outPath, xmlOutName)
-
     def createNewMD(self, evt=None):
         '''Fill owslib by metadata from gui
         '''
@@ -891,7 +1035,7 @@
                         return False
                 except:
                     return False
-
+            
         def noneStatements():
             '''Without condition or loop
             '''
@@ -904,7 +1048,9 @@
                     self.executeStr1(str1, mdDes[self.c])
                     str1 = ''
             self.plusC()
-
+        
+        #def add
+        
         def inStatements():
             '''possible combinations of statements
             (1)    IF
@@ -925,12 +1071,11 @@
             self.plusC()
             # statements of current item
             stat = mdDes[self.c].statements
-
             str1 = ''
             # how many MdItem() is in object
             leng = len(mdDes[self.c].mdItem)
-            # (2.1) IF NECESSARY TO INITIALIZE OWSLIB OBJECT
             
+            # (2.1) IF NECESSARY TO INITIALIZE OWSLIB OBJECT           
             if mdDes[cTmp].object and 'if' not in mdDes[cTmp].tag.split():
                 #print 'init owslib'
                 # self.val=CI_ResponsibleParty()
@@ -954,11 +1099,6 @@
                     str1 = ''
                     self.minusC(numOfItems)
                     
-                    ##print numOfItems
-                #===============================================================
-                # if leng==1:
-                #     leng=2
-                #===============================================================
                 self.plusC(numOfItems)
                 ##print 'c--po',self.c
             # (2.2)
@@ -967,7 +1107,6 @@
 
                 leng = len(mdDes[self.c].mdItem)
                 tag1 = self.jinj._findBetween(tag1, 'zip(', ')').split(',')
-                # #print tag1
 
                 for n in range(leng):
                     numOfItems = 0
@@ -1004,10 +1143,8 @@
 
                 for n in range(leng):
                     numOfItems = 0
-                    # str1 += objStr
                     while mdDes[self.c].statements == stat and self.stop is False:
                         metadata = 'self.' + mdDes[self.c].tag
-
                         str1 += ''.join(metadata) + "='"\
                             + str(mdDes[self.c].mdItem[n].getValue()) + "'\n"
 
@@ -1098,7 +1235,7 @@
 
                         self.executeStr1(str1, False)
                         self.minusC(numOfItems)
-                    self.plusC(numOfItems)  # #TODO TEST -1
+                    self.plusC(numOfItems)  
             # (2) only keywords  (dict)
             elif 'for' in tag and 'for' in tag1:  #
                 #print 'for-for statement'
@@ -1219,8 +1356,27 @@
             # #print mdDes[self.c].statements
             # self.plusC()
             #print '==' * 50
+#------------------------------------ END- FILL OWSLib BY EDITED METADATA IN GUI
+#------------------------------------------------------------------------ LAYOUT
+    def _layout(self):
+        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
+        self.SetSizer(self.mainSizer)
 
-
+        noteSizer = wx.BoxSizer(wx.VERTICAL)
+        self.notebook.SetSizer(noteSizer)
+        self.mainSizer.Add(self.notebook, proportion=1, flag=wx.EXPAND)
+        self.Show()
+        
+    def exportToXml(self, jinjaPath, outPath, xmlOutName):
+        #print '=' * 50
+        self.createNewMD()
+        self.mdo.saveToXML(self.md,None, jinjaPath, outPath, xmlOutName)
+        
+    def exportTemlate(self, jinjaPath, outPath, xmlOutName):
+        self.templatePath=jinjaPath
+        owsTagList=self.defineTemplate()
+        self.createNewMD()
+        self.mdo.saveToXML(self.md,owsTagList, self.templatePath, outPath, xmlOutName)        
 #----------------------------------------------------------------------
 if __name__ == "__main__":
     app = wx.App(False)

Modified: sandbox/krejcmat/src/g.gui.metadata.py
===================================================================
--- sandbox/krejcmat/src/g.gui.metadata.py	2014-07-30 15:06:54 UTC (rev 61460)
+++ sandbox/krejcmat/src/g.gui.metadata.py	2014-07-30 15:17:01 UTC (rev 61461)
@@ -14,13 +14,11 @@
            for details.
 """
 
-
 from lxml import etree as et
 from wx.lib.splitter import MultiSplitterWindow
 import wx
-# import wx.lib.buttons as button
-
 from wx.lib.buttons import ThemedGenBitmapTextButton as BitmapBtnTxt
+from wx import SplitterWindow, EVT_BUTTON
 
 from editor3 import MdMainFrame as mainEditor
 
@@ -28,39 +26,33 @@
 import os
 import sys
 
-#===============================================================================
-# gisbase = os.environ['GISBASE'] = "/home/matt/Documents/grass_trunk/dist.x86_64-unknown-linux-gnu/"
-# gisdbase = os.path.join("/home", "grass_data")
-# location = "nc_basic_spm_grass7"
-# mapset   = "user1"
-# 
-# sys.path.append(os.path.join(os.environ["GISBASE"], "etc", "python"))
-# sys.path.append(os.path.join(os.environ["GISBASE"], "gui", "wxpython"))
-#===============================================================================
 
 import grass.script as grass
 import grass.script.setup as gsetup
 from  lmgr import datacatalog 
 from core.gcmd import RunCommand, GError, GMessage
 import mdgrass
-from wx import SplitterWindow
 
-#===============================================================================
-# gsetup.init(gisbase,
-#             gisdbase, location, mapset)
-# 
-# from grass.pygrass.gis import Mapset
-#===============================================================================
 
 
 
+
 class Toolbar(wx.Panel):
 
     def __init__(self, parent):
-        wx.Panel.__init__(self, parent,id=wx.ID_ANY)
+        wx.Panel.__init__(self, parent, id=wx.ID_ANY)
         self.jinjaFile = None
-        self.xmlPath=None
+        self.xmlPath = None
         self.toolbar = wx.ToolBar(self, 1, wx.DefaultPosition, (-1, -1),)
+#-------------------------------------------------------------------- EDIT 
+        self.toolbar.AddSeparator()
+        bitmapEdit = wx.Image(
+            os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'edit.png'),
+            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
+        self.bttEdit = BitmapBtnTxt(
+            self.toolbar, -1, bitmapEdit,'edit' )
+        self.toolbar.AddControl(control=self.bttEdit)
+        self.bttEdit.Disable()
 
 #-------------------------------------------------------------------- NEW SESION
         self.toolbar.AddSeparator()
@@ -69,10 +61,21 @@
             os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'create.png'),
             wx.BITMAP_TYPE_PNG).ConvertToBitmap()
         self.bttNew = BitmapBtnTxt(
-            self.toolbar, -1, bitmapNew, "new", size=(80, -1))
+            self.toolbar, -1,bitmapNew,'session')
         self.toolbar.AddControl(control=self.bttNew)
         self.bttNew.Disable()
-        self.toolbar.AddSeparator()
+#-------------------------------------------------------------------------- SAVE
+        bitmapSave = wx.Image(
+            os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'save.png'),
+            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
+        self.bttsave = BitmapBtnTxt(
+            self.toolbar, -1, bitmapSave, "XML")
+        self.bttsave.Disable()
+        self.toolbar.AddControl(control=self.bttsave)
+        self.toolbar.AddSeparator()        
+
+        
+        
 #----------------------------------------------------------------- OPEN TEMPLATE
         bitmapLoad = wx.Image(
             os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'open.png'),
@@ -81,49 +84,111 @@
             self.toolbar, -1, bitmapLoad, "template", size=(100, -1))
         self.toolbar.AddControl(control=self.bttLoad)
         self.bttLoad.Disable()
-        self.toolbar.AddSeparator()
+
 #---------------------------------------------------------------------- OPEN XML
-        bitmapLoadXml =wx.Image(
+        bitmapLoadXml = wx.Image(
             os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'open.png'),
             wx.BITMAP_TYPE_PNG).ConvertToBitmap()
         self.bttLoadXml = BitmapBtnTxt(
-            self.toolbar, -1, bitmapLoad, "XML", size=(100, -1))
+            self.toolbar, -1, bitmapLoad, "XML")
         self.toolbar.AddControl(control=self.bttLoadXml)
-        self.bttLoadXml.Disable()
-        #self.toolbar.AddSeparator()        
+        self.bttLoadXml.Disable()     
+
+        self.toolbar.AddSeparator()
+        self.toolbar.AddSeparator()
+        #self.toolbar.SetMargins((500,500))
+#-------------------------------------------------------------------- NEW TEMPLATE
+  
+        bitmapCreateTemplate = wx.Image(
+            os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'create.png'),
+            wx.BITMAP_TYPE_PNG).ConvertToBitmap()
+        self.bttCreateTemplate = BitmapBtnTxt(
+            self.toolbar, -1, bitmapCreateTemplate, "template", size=(100, -1))
+        self.toolbar.AddControl(control=self.bttCreateTemplate)
+        #self.bttNewTenplate.Disable()
         
 #-------------------------------------------------------------------------- SAVE
-        bitmapSave = wx.Image(
+        bitmapSaveTemplate = wx.Image(
             os.path.join(os.environ['GISBASE'], 'gui', 'icons', 'grass', 'save.png'),
             wx.BITMAP_TYPE_PNG).ConvertToBitmap()
-        self.bttsave = BitmapBtnTxt(
-            self.toolbar, -1, bitmapSave, "XML", size=(100, -1))
-        self.bttsave.Disable()
-        self.toolbar.AddControl(control=self.bttsave)
+        self.bttSaveTemplate = BitmapBtnTxt(
+            self.toolbar, -1, bitmapSaveTemplate, "template", size=(100, -1))
+        self.bttSaveTemplate.Disable()
+        self.toolbar.AddControl(control=self.bttSaveTemplate)
+        self.toolbar.AddSeparator()         
+        
+        self.toolbar.AddSeparator()                
+#------------------------------------------------------------------------------ 
 
-        self.toolbar.AddSeparator()
-
         self.toolbar.Realize()
         self._layout()
 
         self.bttLoad.Bind(wx.EVT_BUTTON, self.OnOpenTemplate)
         self.bttsave.Bind(wx.EVT_BUTTON, self.onSaveXML)
         self.bttLoadXml.Bind(wx.EVT_BUTTON, self.onLoadXml)
-        self.bttNew.Bind(wx.EVT_BUTTON,self.onNewSesion)
-    #===========================================================================
-    # def forteseting(self,evt=None):
-    #     self.xmlPath = '/home/matt/Dropbox/gsoc/gsoc2014-krejci/src/metadata/series.xml'
-    #     self.jinjaFile  ='/home/matt/Dropbox/gsoc/gsoc2014-krejci/src/templates/grassInspireTemplateFinal.xml'
-    #       
-    #     self.onChangeXml() 
-    #     self.onChangeTemplate()
-    #===========================================================================
-    def onNewSesion(self,evt):
-        self.GetParent().init()
+        self.bttNew.Bind(wx.EVT_BUTTON, self.onNewSession)
+        self.bttEdit.Bind(wx.EVT_BUTTON, self.onClickEdit)
+        self.bttCreateTemplate.Bind(wx.EVT_BUTTON, self.onCreateTemplate)
+        self.bttSaveTemplate.Bind(wx.EVT_BUTTON,self.onSaveTemplate)
         
-    def onLoadXml(self,evt=None):
+    def onSaveTemplate(self,evt=None):
         dlg = wx.FileDialog(
                             self,
+                            "Choose a file",
+                            os.getcwd(),
+                            "",
+                            "*.xml",
+                            wx.SAVE)
+        
+        if dlg.ShowModal() == wx.ID_OK:
+            if self.jinjaFile is None:
+                self.jinjaFile = self.GetParent().jinjaPath    
+                 
+            self.GetParent().editor.exportTemlate(
+                                self.jinjaFile,
+                                outPath=dlg.GetDirectory(),
+                                xmlOutName=dlg.GetFilename())
+        
+    def onCreateTemplate(self,evt):
+        print 'a'
+        self.GetParent().templateEditor=True
+        self.onClickEdit()
+        self.bttCreateTemplate.Disable()
+        self.bttSaveTemplate.Enable()
+        
+    def onClickEdit(self, evt=None):
+        if self.GetParent().typePanelLeft.rbGrass:
+            self.GetParent().editMapMetadata()
+        else:
+            self.GetParent().init()
+        
+        self.bttEdit.Disable()
+        
+    def onNewSession(self, evt):
+        self.GetParent().init()
+        if self.GetParent().typePanelLeft.rbGrass is False:
+            self.bttLoad.Enable()
+            self.bttLoadXml.Enable() 
+        self.bttsave.Disable()
+        self.bttCreateTemplate.Enable()
+      
+    
+    def onChangeXmlorTemplate(self, evt=None):
+        #self.GetParent().xmlPath = self.xmlPath
+        #self.GetParent().jinjaPath = self.jinjaFile
+
+        if self.jinjaFile is not None and self.xmlPath is not None:
+            #self.GetParent().init()
+            self.GetParent().hideLeftPanel()
+            self.bttEdit.Enable()
+            self.jinjaFile = None
+            self.xmlPath = None
+            self.bttLoad.Disable()
+            self.bttLoadXml.Disable() 
+               
+    def onLoadXml(self, evt=None):
+        dlg = wx.FileDialog(
+                            self,
                             "Choose a xml metadata file",
                             os.getcwd(),
                             "",
@@ -131,70 +196,63 @@
                             wx.OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             self.xmlPath = dlg.GetPath()
-            self.onChangeXml()
+            #self.onChangeXmlorTemplate()
+            self.GetParent().xmlPath = self.xmlPath
+            self.onChangeXmlorTemplate()
             dlg.Destroy()
             
         else:
             dlg.Destroy()
                 
     def onSaveXML(self, evt=None):
-        
         dlg = wx.FileDialog(
-            self,
-            "Choose a file",
-            os.getcwd(),
-            "",
-            "*.xml",
-            wx.SAVE)
+                            self,
+                            "Choose a file",
+                            os.getcwd(),
+                            "",
+                            "*.xml",
+                            wx.SAVE)
         
         if dlg.ShowModal() == wx.ID_OK:
             if self.jinjaFile is None:
-                self.jinjaFile=self.GetParent().jinjaPath
+                self.jinjaFile = self.GetParent().jinjaPath
                 
             self.GetParent().editor.exportToXml(
-                self.jinjaFile,
-                outPath=dlg.GetDirectory(),
-                xmlOutName=dlg.GetFilename())
-        
-    def onChangeXml(self,evt=None):
-        self.GetParent().xmlPath = self.xmlPath
-        if self.jinjaFile:
-            self.GetParent().init()
-    
-    def onChangeTemplate(self, evt=None):
-        self.GetParent().jinjaPath = self.jinjaFile
-        if self.xmlPath:
-            self.GetParent().init()
+                                self.jinjaFile,
+                                outPath=dlg.GetDirectory(),
+                                xmlOutName=dlg.GetFilename())
 
     def OnOpenTemplate(self, evt):
 
         if self.jinjaFile is None:
             dlg = wx.FileDialog(
-                self,
-                "Choose a file",
-                os.getcwd(),
-                "",
-                "*.xml",
-                wx.OPEN)
+                                self,
+                                "Choose a file",
+                                os.getcwd(),
+                                "",
+                                "*.xml",
+                                wx.OPEN)
+            
             if dlg.ShowModal() == wx.ID_OK:
                 self.jinjaFile = dlg.GetPath()
-                self.onChangeTemplate(None)
-                self.bttsave.Enable()
+                self.GetParent().jinjaPath = self.jinjaFile
+                self.onChangeXmlorTemplate()
                 dlg.Destroy()
         else:
             # if user open another template(re-initialize MainFrame)
             dlg = wx.FileDialog(
-                self,
-                "Choose a file",
-                os.getcwd(),
-                "",
-                "*.xml",
-                wx.OPEN)
+                                self,
+                                "Choose a file",
+                                os.getcwd(),
+                                "",
+                                "*.xml",
+                                wx.OPEN)
             
             if dlg.ShowModal() == wx.ID_OK:
                 self.jinjaFile = dlg.GetPath()
                 self.GetParent().init()
-                self.onChangeTemplate()
+                #self.onChangeTemplate()
+                
                 dlg.Destroy()
 
     def _layout(self):
@@ -204,14 +262,16 @@
 
     def message(self, msg, label):
         dlg = wx.MessageDialog(
-            self,
-            msg,
-            label,
-            wx.OK | wx.CANCEL | wx.ICON_INFORMATION)
+                                self,
+                                msg,
+                                label,
+                                wx.OK | wx.CANCEL | wx.ICON_INFORMATION)
         self.msgStatus = dlg.ShowModal()
         dlg.Destroy()
 
-
+#===============================================================================
+# NOTEBOOK ON THE RIGHT SIDE-xml browser+validator
+#===============================================================================
 class NotebookRight(wx.Notebook):
 
     def __init__(self, parent, path):
@@ -227,19 +287,14 @@
                 70,
                 50),
             label='validate')
+        
         self.buttValidate.Bind(wx.EVT_BUTTON, self.validate)
-
         self.notebook_panel1 = wx.Panel(self, wx.ID_ANY)
-
-        #if path is None:
-        #    self.tmpPanel = tempPanel(self.notebook_panel1)
-        #else:
         self.tree = TreeEditor(self.notebook_panel1, path)
 
         # second panel
         self.notebook_panel2 = wx.Panel(self, wx.ID_ANY, style=0)
 
-        # self.notebook_panel1.SetSizer(sizer_2)
         self.AddPage(self.notebook_panel0, "Validator")
         self.AddPage(self.notebook_panel1, "Tree browser")
         self.AddPage(self.notebook_panel2, "Help")
@@ -254,7 +309,7 @@
         self.GetParent().GetParent().editor.createNewMD()
         md = self.GetParent().GetParent().editor.md
 
-        ##print md
+        # #print md
         self.validator.validate_inspire(md)
 
     def _layout(self, path):
@@ -275,68 +330,59 @@
         panelSizer2 = wx.BoxSizer(wx.VERTICAL)
         self.notebook_panel2.SetSizer(panelSizer2)
 
-
+#===============================================================================
+# CONFIGURATION PANEL ON THE LEFT SIDE
+#===============================================================================
 class MdEditConfigPanel(wx.Panel):
     
     def __init__(self, parent):
-        wx.Panel.__init__(self, parent,id=wx.ID_ANY)
-        self.SetMinSize((240,-1))
-        self.mapGrassEdit=True
+        wx.Panel.__init__(self, parent, id=wx.ID_ANY)
+        self.SetMinSize((240, -1))
+        self.mapGrassEdit = True
 
         self.rbGrass = wx.RadioButton(self, id=wx.ID_ANY, label='Metadata map editor', style=wx.RB_GROUP)
         self.rbExternal = wx.RadioButton(self, id=wx.ID_ANY, label='Metadata external editor')
 
-        self.comboBoxProfile=wx.ComboBox(self,choices=['INSPIRE','GRASS BASIC','Load Custom'])
+        self.comboBoxProfile = wx.ComboBox(self, choices=['INSPIRE', 'GRASS BASIC', 'Load Custom'])
         self.comboBoxProfile.SetStringSelection('GRASS BASIC')
-        self.buttEdit=wx.Button(self,id=wx.ID_ANY,label='Edit')
+        
 
-        
-        self.buttEdit.Bind(wx.EVT_BUTTON,self.onClickEdit)
         self.Bind(wx.EVT_RADIOBUTTON, self.onSetRadioType, id=self.rbGrass.GetId())
         self.Bind(wx.EVT_RADIOBUTTON, self.onSetRadioType, id=self.rbExternal.GetId())  
-        #self.SetVal(True)      
+        # self.SetVal(True)      
         self._layout()
 
     def SetVal(self, event):
         state1 = str()
         state2 = str(self.rb2.GetValue())
 
-        self.statusbar.SetStatusText(state1,0)
-        self.statusbar.SetStatusText(state2,1)
+        self.statusbar.SetStatusText(state1, 0)
+        self.statusbar.SetStatusText(state2, 1)
 
-    def onSetRadioType(self,evt=None):
-        self.mapGrassEdit=self.rbGrass.GetValue()
-        if self.mapGrassEdit==False:
+    def onSetRadioType(self, evt=None):
+        self.mapGrassEdit = self.rbGrass.GetValue()
+        if self.mapGrassEdit == False:
             self.comboBoxProfile.Hide()
-            self.buttEdit.Hide()
+            #self.buttEdit.Hide()
         else:
             self.comboBoxProfile.Show()
-            self.buttEdit.Show()
+            #self.buttEdit.Show()
+            
         self.GetParent().GetParent().editingStatus(self.mapGrassEdit)
 
-       #print parent
+       # print parent
     
-    def onClickEdit(self,evt=None):
-        
-        self.templeteChoice=self.comboBoxProfile.GetValue()
-        self.GetParent().GetParent().editMapMetadata(self.templeteChoice)
-        
-        #self.buttEdit.Disable()
-        #self.rbGrass.Disable()
-        #self.rbExternal.Disable()
-        #self.comboBoxProfile.Disable()
-
-        
-        
+  
     def _layout(self):
         self.mainsizer = wx.BoxSizer(wx.VERTICAL)
         self.SetSizer(self.mainsizer)
         self.mainsizer.Add(self.rbGrass)
         self.mainsizer.Add(self.rbExternal)        
         self.mainsizer.Add(self.comboBoxProfile)        
-        self.mainsizer.Add(self.buttEdit)            
         
-        
+#===============================================================================
+# MAIN        
+#===============================================================================
 class MainFrame(wx.Frame):
 
     def __init__(self, jinjaPath=None, xmlPath=None, pos=None):
@@ -346,57 +392,61 @@
         # self.template
         self.jinjaPath = jinjaPath
         self.xmlPath = xmlPath
-        self.first=True
-        self.firstAfterChoice=False
-        self.second=False
-        self.secondAfterChoice=False
-        
+        self.first = True
+        self.firstAfterChoice = False
+        self.second = False
+        self.secondAfterChoice = False
+        self.templateEditor=False
         self.init()
-
-            
+          
     def refreshConfig(self):
 
         if self.jinjaPath and self.xmlPath:
-            self.editor = mainEditor(self.splitter,self.jinjaPath,self.xmlPath)
+            self.editor = mainEditor(self.splitter, self.jinjaPath, self.xmlPath)
             
             self.splitter.AppendWindow(self.editor)
-            self.splitter.AppendWindow(NotebookRight(self.splitter,self.xmlPath))
+            self.splitter.AppendWindow(NotebookRight(self.splitter, self.xmlPath))
             self.toolbar.bttsave.Enable()
             self.Show()
             
-    def resizeFrame(self,x1=1,y1=0):
-            x,y=self.GetSize()
-            self.SetSize((x+x1,y+y1))      
-              
-    def editMapMetadata(self,templeteChoice):
-        map=self.mapTreePanelLeft.map
-        maptype=self.mapTreePanelLeft.mapType      
-
-        if map is not None:
-            
+    def resizeFrame(self, x1=1, y1=0):
+            x, y = self.GetSize()
+            self.SetSize((x + x1, y + y1)) 
+                 
+    def hideLeftPanel(self):
             self.toolbar.bttNew.Enable()
             self.toolbar.bttsave.Enable()
             self.Hsizer.Remove(self.leftPanel)
-            self.leftPanel.SetSize((1,1))
-            #self.Hsizer.Fit()
+            self.leftPanel.SetSize((1, 1))
+            # self.Hsizer.Fit()
             self.splitter.Refresh()
             self.resizeFrame()
-            self.splitter.SetSashGravity(0.7)
+            self.splitter.SetSashGravity(0.7)        
+        
+                
+    def editMapMetadata(self):
+        map = self.MdDataCatalogPanelLeft.map
+        maptype = self.MdDataCatalogPanelLeft.mapType      
+        templeteChoice=self.typePanelLeft.comboBoxProfile.GetValue()
+        
+        
+        if map is not None:
             
-            mdCreator=mdgrass.GrassMD(map,maptype)                
-            if templeteChoice=='INSPIRE':
+            self.hideLeftPanel()
+            mdCreator = mdgrass.GrassMD(map, maptype)                
+            if templeteChoice == 'INSPIRE':
                 mdCreator.createGrassInspireISO()
-                self.jinjaPath=mdCreator.templatePathAbs
+                self.jinjaPath = mdCreator.templatePathAbs
                 self.xmlPath = mdCreator.saveXML()
                 self.init()
                 
-            elif templeteChoice=='GRASS BASIC':
+            elif templeteChoice == 'GRASS BASIC':
                 mdCreator.createGrassBasicISO()
-                self.jinjaPath=mdCreator.templatePathAbs
+                self.jinjaPath = mdCreator.templatePathAbs
                 self.xmlPath = mdCreator.saveXML()
                 self.init()
                     
-            elif templeteChoice=='Load Custom':   
+            elif templeteChoice == 'Load Custom':   
                 dlg = wx.FileDialog(
                             self,
                             "Choose a file",
@@ -411,59 +461,60 @@
                     self.xmlPath = mdCreator.saveXML()
                     self.init()
         else:            
-            pass
-        
-                                   
-    def editingStatus(self,editStatus):
-        
+             GMessage('Select map in data catalog...')
+          
+    def editingStatus(self, editStatus):
+        self.resizeFrame()
         if editStatus:
-            self.mapTreePanelLeft.Show()
+            self.MdDataCatalogPanelLeft.Show()
             self.toolbar.bttLoad.Disable()
             self.toolbar.bttLoadXml.Disable()
-            
+            self.toolbar.bttEdit.Enable()
         else:
-            self.mapTreePanelLeft.Hide()
+            self.MdDataCatalogPanelLeft.Hide()
+            self.toolbar.bttEdit.Disable()
             self.toolbar.bttLoad.Enable()
             self.toolbar.bttLoadXml.Enable()
     
     def init(self):
 
             if self.first:
-                self.first=False
-                self.firstAfterChoice=True
+                self.first = False
+                self.firstAfterChoice = True
                 print "first-----"
                 self.toolbar = Toolbar(self)
                 
-                self.leftPanel=wx.Panel(self,id=wx.ID_ANY)
-                self.typePanelLeft=MdEditConfigPanel(self.leftPanel)
-                self.mapTreePanelLeft=MapTree(self.leftPanel)
-                self.splitter =SplitterWindow(
+                self.leftPanel = wx.Panel(self, id=wx.ID_ANY)
+                self.typePanelLeft = MdEditConfigPanel(self.leftPanel)
+                self.MdDataCatalogPanelLeft = MdDataCatalog(self.leftPanel)
+                self.splitter = SplitterWindow(
                                                   self,
-                                                  style=wx.SP_3D | wx.SP_LIVE_UPDATE)                              
+                                                  style=wx.SP_3D | wx.SP_LIVE_UPDATE|wx.SP_BORDER)                              
                 self.Show()
                 self._layout()
 
             elif self.firstAfterChoice:
                 if self.jinjaPath and self.xmlPath:
                     print "firstAfterChoice-----"
-                    self.firstAfterChoice=False
-                    self.second=True
+                    self.firstAfterChoice = False
+                    self.second = True
                     self.editor = mainEditor(
                                             self.splitter,
                                             self.jinjaPath,
-                                            self.xmlPath)
-                    self.ntbRight=NotebookRight(self.splitter,self.xmlPath)
-                    self.splitter.SplitVertically(self.editor, self.ntbRight,sashPosition=0.6)
-                    #self.toolbar.bttsave.Enable()
-                    #self._layout()
+                                            self.xmlPath,
+                                            self.templateEditor)
+                    self.ntbRight = NotebookRight(self.splitter, self.xmlPath)
+                    self.splitter.SplitVertically(self.editor, self.ntbRight, sashPosition=0.6)
+                    # self.toolbar.bttsave.Enable()
+                    # self._layout()
                     self.resizeFrame(1, 0)
                     self.Show()
             
-            elif self.second:#if next initializing of editor
+            elif self.second:  # if next initializing of editor
                 
                 print "second-----"
-                self.second=False
-                self.secondAfterChoice=True
+                self.second = False
+                self.secondAfterChoice = True
                 self.splitter.Hide()
                 self.toolbar.bttNew.Disable()
                 self.toolbar.bttsave.Disable()
@@ -474,66 +525,77 @@
             elif self.secondAfterChoice:
                 if self.jinjaPath and self.xmlPath:
                     print 'secondAfterChoice'
-                    self.secondAfterChoice=False
-                    self.second=True
+                    self.secondAfterChoice = False
+                    self.second = True
                     self.splitter.Show()
                     self.toolbar.bttNew.Enable() 
                     self.toolbar.bttsave.Enable()
-                    ntbRightBCK=self.ntbRight     
-                    self.ntbRight=NotebookRight(self.splitter,self.xmlPath) 
-                    self.splitter.ReplaceWindow(ntbRightBCK,self.ntbRight)                 
+                    ntbRightBCK = self.ntbRight     
+                    self.ntbRight = NotebookRight(self.splitter, self.xmlPath) 
+                    self.splitter.ReplaceWindow(ntbRightBCK, self.ntbRight)                 
                     
-                    editorTMP=self.editor
+                    editorTMP = self.editor
                     self.editor = mainEditor(
-                        self.splitter,#
+                        self.splitter,  #
                         self.jinjaPath,
-                        self.xmlPath)
+                        self.xmlPath,
+                        self.templateEditor)
                     
-                    self.splitter.ReplaceWindow(editorTMP,self.editor)
+                    self.splitter.ReplaceWindow(editorTMP, self.editor)
                     ntbRightBCK.Destroy()
                     editorTMP.Destroy()
                     self.resizeFrame()
                     self.Show()
                     self.splitter.SetSashGravity(0.6)                
+            else:
+                GMessage('Select map in data catalog...')
                 
+                
     def _layout(self):
         
-        #if state=='first':
+        # if state=='first':
             self.mainSizer = wx.BoxSizer(wx.VERTICAL)
             self.SetSizer(self.mainSizer)
                 
             self.mainSizer.Add(self.toolbar)
             self.mainSizer.Add(
                 wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL, size=(10000, 5)))
-            self.mainSizer.Add(
-                wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL, size=(0, 5)))        
+            self.mainSizer.AddSpacer(5, 5, 1, wx.EXPAND)
     
-            self.leftPanelSizer=wx.BoxSizer(wx.VERTICAL)
+            self.leftPanelSizer = wx.BoxSizer(wx.VERTICAL)
             self.leftPanel.SetSizer(self.leftPanelSizer)
             self.leftPanelSizer.Add(self.typePanelLeft, proportion=0.2, flag=wx.EXPAND)
-            self.leftPanelSizer.Add(self.mapTreePanelLeft, proportion=1, flag=wx.EXPAND)
+            self.leftPanelSizer.AddSpacer(5, 5, 1, wx.EXPAND)
+            self.leftPanelSizer.Add(self.MdDataCatalogPanelLeft, proportion=1, flag=wx.EXPAND)
         
-            self.Hsizer=wx.BoxSizer(wx.HORIZONTAL)
-            self.mainSizer.Add(self.Hsizer,proportion=1,flag=wx.EXPAND)        
+            self.Hsizer = wx.BoxSizer(wx.HORIZONTAL)
+            self.mainSizer.Add(self.Hsizer, proportion=1, flag=wx.EXPAND)        
         
             self.Hsizer.Add(self.leftPanel, proportion=0.5, flag=wx.EXPAND)
-            x,y=self.GetSize()
-            self.SetSize((x+1,y))
-        #else:
-            #print '2 lay----'
+            x, y = self.GetSize()
+            self.SetSize((x + 1, y))
+        # else:
+            # print '2 lay----'
             self.Hsizer.Add(self.splitter, proportion=1, flag=wx.EXPAND)
             self.splitter.SetSashGravity(0.6)
             self.splitter.SizeWindows()
             self.resizeFrame(300, 0)
-########################################################################
-class MapTree(datacatalog.LocationMapTree):
+            
+#===============================================================================
+# DATA CATALOG
+#===============================================================================
+class MdDataCatalog(datacatalog.LocationMapTree):
     
         def __init__(self, parent):
             """Test Tree constructor."""
-            super(MapTree, self).__init__(parent)
+            super(MdDataCatalog, self).__init__(parent )
+            #===================================================================
+            # style =wx.TR_MULTIPLE|
+            #          ,id=wx.ID_ANY                         wx.TR_HAS_BUTTONS|wx.TR_FULL_ROW_HIGHLIGHT
+            #===================================================================
             self.InitTreeItems()
-            self.map=None
-            self.mapType=None
+            self.map = None
+            self.mapType = None
             
         def InitTreeItems(self):
             """Add locations, mapsets and layers to the tree."""
@@ -543,17 +605,18 @@
             self._initTreeItems(locations=[location],
                                 mapsets=[self.mapset])
             self.ExpandAll()
-            self.Bind(wx.EVT_TREE_SEL_CHANGED,self.onChanged)
+            self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onChanged)
             
-        def onChanged(self,evt=None):
-            if self.GetChildrenCount(evt.Item)==0:
-                self.map = self.GetItemText(evt.Item)+ '@'+self.mapset
-                self.mapType=self.GetItemParent(evt.Item)
-                self.mapType=self.GetItemText(self.mapType)               
-                if self.mapType =='vect':
-                    self.mapType='vector'
+        def onChanged(self, evt=None):
+            if self.GetChildrenCount(evt.Item) == 0:
+                self.map = self.GetItemText(evt.Item) + '@' + self.mapset
+                self.mapType = self.GetItemParent(evt.Item)
+                self.mapType = self.GetItemText(self.mapType)               
+                if self.mapType == 'vect':
+                    self.mapType = 'vector'
                 elif self.mapType == 'rast':
-                    self.mapType='cell'
+                    self.mapType = 'cell'
+                self.GetParent().GetParent().toolbar.bttEdit.Enable()
             else:
                 GMessage('Please select map.')
 
@@ -566,18 +629,14 @@
             pass
 
 
-class Html(wx.Panel):
-
-    def __init__(self, parent):
-        pass
-
-
 class RandomPanel(wx.Panel):
 
     def __init__(self, parent, color):
         wx.Panel.__init__(self, parent)
         self.SetBackgroundColour(color)
-
+#===============================================================================
+# TREE EDITOR
+#===============================================================================
 class TreeEditor(wx.TreeCtrl):
 
     def __init__(self, parent, xmlPath):
@@ -585,7 +644,7 @@
             self,
             parent=parent,
             id=wx.ID_ANY,
-            style=wx.TR_HAS_BUTTONS)
+            style=wx.TR_HAS_BUTTONS|wx.TR_FULL_ROW_HIGHLIGHT)
         
         self.parent = parent
         self.fpath = xmlPath
@@ -652,8 +711,8 @@
     def __init__(self, parent):
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
         self.text = wx.TextCtrl(parent, id=wx.ID_ANY, size=(0, 55),
-                                style=wx.VSCROLL |
-                                wx.TE_MULTILINE | wx.TE_NO_VSCROLL |
+                                style=wx.VSCROLL | 
+                                wx.TE_MULTILINE | wx.TE_NO_VSCROLL | 
                                 wx.TAB_TRAVERSAL | wx.RAISED_BORDER | wx.HSCROLL)
         self._layout()
 
@@ -749,25 +808,25 @@
                     errors += 1
                 if self.md.identification.resourcelanguage is (None or '') or len(
                         self.md.identification.resourcelanguage) < 1 or\
-                        self.md.identification.resourcelanguage[0]=='':
+                        self.md.identification.resourcelanguage[0] == '':
                     result["errors"].append(
                         "gself.md:language: Resource Language is missing")
                     errors += 1
                 if self.md.identification.uricode is (None or '') or len(
                         self.md.identification.uricode) < 1 or\
-                        self.md.identification.uricode[0]=='':
+                        self.md.identification.uricode[0] == '':
                     result["errors"].append(
                         "gself.md:RS_Identifier: Unique Resource Identifier is missing")
                     errors += 1
                 if self.md.identification.topiccategory is (None or '') or len(
                         self.md.identification.topiccategory) < 1 or\
-                        self.md.identification.topiccategory[0]=='':
+                        self.md.identification.topiccategory[0] == '':
                     result["errors"].append(
                         "gself.md:topicCategory: TopicCategory is missing")
                     errors += 1
                 if self.md.identification.keywords is (None or '') or len(
                         self.md.identification.keywords) < 1 or\
-                        self.md.identification.keywords[0]=='':
+                        self.md.identification.keywords[0] == '':
                     result["errors"].append(
                         "gself.md:self.md_Keywords: Keywords are missing")
                     result["errors"].append(
@@ -842,17 +901,17 @@
                     errors += 1
 
                 if len(self.md.identification.uselimitation) < 1 or\
-                         self.md.identification.uselimitation[0]=='':
+                         self.md.identification.uselimitation[0] == '':
                     result["errors"].append(
                         "gself.md:useLimitation is missing")
                     errors += 1
                 if len(self.md.identification.accessconstraints) < 1 or\
-                        self.md.identification.accessconstraints[0]=='':
+                        self.md.identification.accessconstraints[0] == '':
                     result["errors"].append(
                         "gself.md:accessConstraints is missing")
                     errors += 1
                 if len(self.md.identification.otherconstraints) < 1 or\
-                        self.md.identification.otherconstraints[0]=='':
+                        self.md.identification.otherconstraints[0] == '':
                     result["errors"].append(
                         "gself.md:otherConstraints is missing")
                     errors += 1
@@ -883,12 +942,12 @@
                     result["errors"].append("gself.md:LI_Lineage is missing")
                     errors += 1
                 if len(self.md.dataquality.conformancedate) < 1 or \
-                    self.md.dataquality.conformancedate[0]=='':
+                    self.md.dataquality.conformancedate[0] == '':
                     result["errors"].append(
                         "gself.md:DQ_ConformanceResult: date is missing")
                     errors += 1
                 if len(self.md.dataquality.conformancedatetype) < 1 or\
-                       self.md.dataquality.conformancedatetype[0]=='' :
+                       self.md.dataquality.conformancedatetype[0] == '' :
                     result["errors"].append(
                         "gself.md:DQ_ConformanceResult: date type is missing")
                     errors += 1
@@ -896,7 +955,7 @@
                 #     result["errors"].append("gself.md:DQ_ConformanceResult: degree is missing")
                 #     errors += 1
                 if len(self.md.dataquality.conformancetitle) < 1 or\
-                    self.md.dataquality.conformancetitle[0]=='':
+                    self.md.dataquality.conformancetitle[0] == '':
                     result["errors"].append(
                         "gself.md:DQ_ConformanceResult: title is missing")
                     errors += 1
@@ -920,8 +979,8 @@
             if errors > 0:
                 result["status"] = "failed"
                 result["num_of_errors"] = str(errors)
-            #print result
-            str1  = 'INSPIRE VALIDATOR\n'
+            # print result
+            str1 = 'INSPIRE VALIDATOR\n'
             str1 += 'Status of validation: ' + result["status"] + '\n'
             str1 += 'Numbers of errors: ' + result["num_of_errors"] + '\n'
 

Modified: sandbox/krejcmat/src/jinjainfo.py
===================================================================
--- sandbox/krejcmat/src/jinjainfo.py	2014-07-30 15:06:54 UTC (rev 61460)
+++ sandbox/krejcmat/src/jinjainfo.py	2014-07-30 15:17:01 UTC (rev 61461)
@@ -18,13 +18,13 @@
 from lxml import etree as et
 import os
 from jinja2 import Environment, FileSystemLoader
+#from unidecode  import unidecode
 
-
 class MdDescription():
 
     def __init__(self, tag=None, object=None, name='', desc=None,
                  example=None, type=None, multi=0, inboxmulti=None, group=None,
-                 inbox=None, multiline=None, validator=None, num=None, ref=None):
+                 inbox=None, multiline=None, validator=None, num=None, ref=None,selfInfoString=None):
         # ++info from jinja start
         self.tag = tag
         self.object = object
@@ -36,6 +36,7 @@
         self.group = group
         self.inbox = inbox
         self.ref=ref
+        self.selfInfoString=selfInfoString
         # multiplicity in subrotoup (in static box)
         self.inboxmulti = inboxmulti
         self.multiline = multiline  # type of ctrl text
@@ -52,9 +53,6 @@
         '''
         # if new mditem is from box- need to hold information
         # about it.(list on same index in self.mdItem)
-
-        #print self.mdItem, ' list'
-
         if oldMdItem is not None:
             for n, item in enumerate(self.mdItem):
                 #print 'here------------2'
@@ -150,10 +148,9 @@
 
         except IOError as e:
             pass
-            #print "I/O error({0}): {1}".format(e.errno, e.strerror)
+            print "I/O error({0}): {1}".format(e.errno, e.strerror)
 
     def _readJinjaInfo(self):
-        # template = 'data/grassBasicISOTemplate01.xml'
         counter = 1
 
         try:
@@ -165,10 +162,19 @@
 
                         ##print 'num' + str(counter)
                         values = self._findBetween(line, "{#", "#}")
+                        
                         values += ',num=' + str(counter)
+                        
+                        values1 =self._findBetween(line, "{%", "#}")
+                        values2 =self._findBetween(line, "{{", "#}")
+                        if values1 !='':
+                            values+=",selfInfoString='''{%"+values1+"#}'''"
+                        else:
+                            values+=",selfInfoString='''{{"+values2+"#}'''"
                         ##print values
                         exe_str = "self.mdDescription.append(MdDescription(%s))" % values
                         #print exe_str
+                        exe_str=exe_str.decode("utf-8",'ignore')
                         eval(exe_str)
                         counter += 1
         except IOError as e:

Modified: sandbox/krejcmat/src/templates/grassGRASSTemplateFinal.xml
===================================================================
--- sandbox/krejcmat/src/templates/grassGRASSTemplateFinal.xml	2014-07-30 15:06:54 UTC (rev 61460)
+++ sandbox/krejcmat/src/templates/grassGRASSTemplateFinal.xml	2014-07-30 15:17:01 UTC (rev 61461)
@@ -1,188 +1,164 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- ISO 19115:2003 file created from OWSLib object model -->
 <gmd:MD_Metadata xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
-  <gmd:fileIdentifier>
-    <gco:CharacterString>{{ md.identifier }}{# tag="md.identifier",ref="Part B 1.5",  name ="Resource Identifier", desc ="Unique Resource Identifier", example ="286c0725-046e-4533-b0bf-d6e367f6c342", type = "CharacterString", multi = 0, group = "Identification", multiline=False #}</gco:CharacterString>
-  </gmd:fileIdentifier>
-  <gmd:language>
-    <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ md.languagecode }}">{# tag="md.languagecode", name ="Metadata language", desc ="Language(s) used within the datasets", example ="eng", type = "CharacterString", multi = 0, group = "Metadata",multiline=False #}</gmd:LanguageCode>
-  </gmd:language>
-  <gmd:hierarchyLevel>
-    <gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #}</gmd:MD_ScopeCode>
-  </gmd:hierarchyLevel>
+    <gmd:fileIdentifier>
+        <gco:CharacterString>{{ md.identifier }}{# tag="md.identifier",ref="Part B 1.5",  name ="Resource Identifier", desc ="Unique Resource Identifier", example ="286c0725-046e-4533-b0bf-d6e367f6c342", type = "CharacterString", multi = 0, group = "Identification", multiline=False #}</gco:CharacterString>
+    </gmd:fileIdentifier>
+    <gmd:language>
+        <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ md.languagecode }}{# tag="md.languagecode", name ="Metadata language", desc ="Language(s) used within the datasets", example ="eng", type = "CharacterString", multi = 0, group = "Metadata",multiline=False #}"></gmd:LanguageCode>
+    </gmd:language>
+    <gmd:hierarchyLevel>
+        <gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=False #}</gmd:MD_ScopeCode>
+    </gmd:hierarchyLevel>
   {% for co in md.contact -%}{# tag="for co in md.contact",  inboxmulti = 1, group = "Metadata",inbox="Metadata point of contact",object="CI_ResponsibleParty()" #}
-  <gmd:contact>
-    <gmd:CI_ResponsibleParty>
-      <gmd:organisationName>
-        <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  inboxmulti = 1,multi = 0, group = "Metadata",object="CI_ResponsibleParty()", inbox="Metadata point of contact",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
-      </gmd:organisationName>
-      <gmd:contactInfo>
-        <gmd:CI_Contact>
-          <gmd:address>
-            <gmd:CI_Address>
-              <gmd:electronicMailAddress>
-                <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1",  multi = 0,object="CI_ResponsibleParty()", inboxmulti = 1,group = "Metadata", inbox="Metadata point of contact",example="image2000 at jrc.it", desc="Party responsible for the metadata information." #}</gco:CharacterString>
-              </gmd:electronicMailAddress>
-            </gmd:CI_Address>
-          </gmd:address>
-        </gmd:CI_Contact>
-      </gmd:contactInfo>
-      <gmd:role>
-        <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{  co.role }}"{# tag="co.role",name="Responsible party role",ref="Part B 9.2" , multi = 0, inboxmulti = 1,group = "Responsible party",object="CI_ResponsibleParty()", inbox="Metadata pointt of contact",example="custodian", desc="function performed by the responsible party" #} codeSpace="ISOTC211/19115">
-</gmd:CI_RoleCode>
-      </gmd:role>
-    </gmd:CI_ResponsibleParty>
-  </gmd:contact>
+    <gmd:contact>
+        <gmd:CI_ResponsibleParty>
+            <gmd:organisationName>
+                <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  inboxmulti = 1,multi = 0, group = "Metadata",object="CI_ResponsibleParty()", inbox="Metadata point of contact",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
+            </gmd:organisationName>
+            <gmd:contactInfo>
+                <gmd:CI_Contact>
+                    <gmd:address>
+                        <gmd:CI_Address>
+                            <gmd:electronicMailAddress>
+                                <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1",  multi = 0,object="CI_ResponsibleParty()", inboxmulti = 1,group = "Metadata", inbox="Metadata point of contact",example="image2000 at jrc.it", desc="Party responsible for the metadata information." #}</gco:CharacterString>
+                            </gmd:electronicMailAddress>
+                        </gmd:CI_Address>
+                    </gmd:address>
+                </gmd:CI_Contact>
+            </gmd:contactInfo>
+            <gmd:role>
+                <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{  co.role }}{# tag="co.role",name="Responsible party role",ref="Part B 9.2" , multi = 0, inboxmulti = 1,group = "Responsible party",object="CI_ResponsibleParty()", inbox="Metadata pointt of contact",example="custodian", desc="function performed by the responsible party" #}" codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
+            </gmd:role>
+        </gmd:CI_ResponsibleParty>
+    </gmd:contact>
   {% endfor -%}
-  <gmd:dateStamp>
-    <gco:Date>{{ md.datestamp }}{# tag="md.datestamp" , name="Metadata date" , ref= "Part B 10.2" , desc= "Date that the metadata was created." , example = "2005-03-27" , type ="Date" , multi= 0 , group= "Metadata" , multiline= False #}</gco:Date>
-  </gmd:dateStamp>
-  <gmd:metadataStandardName>
-    <gco:CharacterString>ISO 19115</gco:CharacterString>
-  </gmd:metadataStandardName>
-  <gmd:metadataStandardVersion>
-    <gco:CharacterString>2003/Cor.1:2006</gco:CharacterString>
-  </gmd:metadataStandardVersion>
-  <gmd:identificationInfo>
-    <gmd:MD_DataIdentification>
-      <gmd:citation>
-        <gmd:CI_Citation>
-          <gmd:title>
-            <gco:CharacterString>{{ md.identification.title }}{# tag="md.identification.title", ref="Part B 1.1", name ="Resource title", desc ="Name by which the cited resource is known.", example ="Image2000 Product 1 (nl2) MultispectB 10.1" , multi = 0, group ="Identification", type = "CharacterString", multiline=False #}</gco:CharacterString>
-          </gmd:title>
+    <gmd:dateStamp>
+        <gco:Date>{{ md.datestamp }}{# tag="md.datestamp" , name="Metadata date" , ref= "Part B 10.2" , desc= "Date that the metadata was created." , example = "2005-03-27" , type ="Date" , multi= 0 , group= "Metadata" , multiline= False #}</gco:Date>
+    </gmd:dateStamp>
+    <gmd:metadataStandardName>
+        <gco:CharacterString>ISO 19115</gco:CharacterString>
+    </gmd:metadataStandardName>
+    <gmd:metadataStandardVersion>
+        <gco:CharacterString>2003/Cor.1:2006</gco:CharacterString>
+    </gmd:metadataStandardVersion>
+    <gmd:identificationInfo>
+        <gmd:MD_DataIdentification>
+            <gmd:citation>
+                <gmd:CI_Citation>
+                    <gmd:title>
+                        <gco:CharacterString>{{ md.identification.title }}{# tag="md.identification.title", ref="Part B 1.1", name ="Resource title", desc ="Name by which the cited resource is known.", example ="Image2000 Product 1 (nl2) MultispectB 10.1" , multi = 0, group ="Identification", type = "CharacterString", multiline=False #}</gco:CharacterString>
+                    </gmd:title>
           {% for d in md.identification.date -%}{# tag="for d in md.identification.date" ,name="",object="CI_Date()",group= "Temporal" , inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False #}
-          <gmd:date>
-            <gmd:CI_Date>
-              <gmd:date>
-                <gco:DateTime>{{ d.date }}{# tag="d.date" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="Date of: type(below)",desc="reference date for the cited resource – publication/creation/revision",example="2007-09-15" #}</gco:DateTime>
-              </gmd:date>
-              <gmd:dateType>
-                <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ d.type }}"{# tag="d.type" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="type: creation/publication/revision",desc="reference date for the cited resource – publication/creation/revision",example="creation" #}
+                    <gmd:date>
+                        <gmd:CI_Date>
+                            <gmd:date>
+                                <gco:DateTime>{{ d.date }}{# tag="d.date" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="Date of: type(below)",desc="reference date for the cited resource - publication/creation/revision",example="2007-09-15" #}</gco:DateTime>
+                            </gmd:date>
+                            <gmd:dateType>
+                                <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ d.type }}{# tag="d.type" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="type: creation/publication/revision",desc="reference date for the cited resource - publication/creation/revision",example="creation" #}"
  codeSpace="ISOTC211/19115"></gmd:CI_DateTypeCode>
-              </gmd:dateType>
-            </gmd:CI_Date>
-          </gmd:date>
-        </gmd:CI_Citation>
-      </gmd:citation>
+                            </gmd:dateType>
+                        </gmd:CI_Date>
+                    </gmd:date>
+                </gmd:CI_Citation>
+            </gmd:citation>
       {% endfor -%}
-      <gmd:abstract>
-        <gco:CharacterString>{{ md.identification.abstract }}{# tag="md.identification.abstract ",ref="Part B 1.2",  name ="Resource Abstract", desc ="Brief narrative summary of the content of the resource(s).", example ="IMAGE2000 product 1 individual orthorectified scenes. IMAGE2000 was produced from ETM+ Landsat 7 satellite data and provides a consistent European coverage of individual orthorectified scenes in national map projection systems. The year 2000 was targeted as reference year, but a deviation of maximum 1-year was allowed to obtain a full coverage of Europe, which involves approximately 450 Landsat TM Frames. Where Landsat 7 data were not available, Landsat 5 data have been used instead. The spatial resolution is 25 metres for multispectral and 12.5 metres for panchromatic imagery", type = "CharacterString", multi = 0, group = "Identification", multiline=True #}</gco:CharacterString>
-      </gmd:abstract>
+            <gmd:abstract>
+                <gco:CharacterString>{{ md.identification.abstract }}{# tag="md.identification.abstract ",ref="Part B 1.2",  name ="Resource Abstract", desc ="Brief narrative summary of the content of the resource(s).", example ="IMAGE2000 product 1 individual orthorectified scenes. IMAGE2000 was produced from ETM+ Landsat 7 satellite data and provides a consistent European coverage of individual orthorectified scenes in national map projection systems. The year 2000 was targeted as reference year, but a deviation of maximum 1-year was allowed to obtain a full coverage of Europe, which involves approximately 450 Landsat TM Frames. Where Landsat 7 data were not available, Landsat 5 data have been used instead. The spatial resolution is 25 metres for multispectral and 12.5 metres for panchromatic imagery", type = "CharacterString", multi = 0, group = "Identification", multiline=True #}</gco:CharacterString>
+            </gmd:abstract>
       {% for co in md.identification.contact -%}{# tag="for co in md.identification.contact",object="CI_ResponsibleParty()", inboxmulti=1, group = "Responsible party",inbox="Point of contact" #}
-      <gmd:pointOfContact>
-        <gmd:CI_ResponsibleParty>
-          <gmd:organisationName>
-            <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  multi = 0, group = "Responsible party",inboxmulti=1 ,inbox="Point of contact",object="CI_ResponsibleParty()",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
-          </gmd:organisationName>
-          <gmd:contactInfo>
-            <gmd:CI_Contact>
-              <gmd:address>
-                <gmd:CI_Address>
-                  <gmd:electronicMailAddress>
-                    <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1" , group = "Metadata",inboxmulti=1, inbox="Responsible party",multi=0,example="image2000 at jrc.it",object="CI_ResponsibleParty()", desc="Party responsible for the metadata information." #}</gco:CharacterString>
-                  </gmd:electronicMailAddress>
-                </gmd:CI_Address>
-              </gmd:address>
-            </gmd:CI_Contact>
-          </gmd:contactInfo>
-          <gmd:role>
-            <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{ co.role }}"{# tag="co.role",inboxmulti=1,name="Responsible party role",object="CI_ResponsibleParty()",ref="Part B 9.2",  multi = 0, group = "Responsible party", inbox="Responsible party",example="custodian", desc="function performed by the responsible party" #} codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
-          </gmd:role>
-        </gmd:CI_ResponsibleParty>
-      </gmd:pointOfContact>
+            <gmd:pointOfContact>
+                <gmd:CI_ResponsibleParty>
+                    <gmd:organisationName>
+                        <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  multi = 0, group = "Responsible party",inboxmulti=1 ,inbox="Point of contact",object="CI_ResponsibleParty()",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
+                    </gmd:organisationName>
+                    <gmd:contactInfo>
+                        <gmd:CI_Contact>
+                            <gmd:address>
+                                <gmd:CI_Address>
+                                    <gmd:electronicMailAddress>
+                                        <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1" , group = "Metadata",inboxmulti=1, inbox="Responsible party",multi=0,example="image2000 at jrc.it",object="CI_ResponsibleParty()", desc="Party responsible for the metadata information." #}</gco:CharacterString>
+                                    </gmd:electronicMailAddress>
+                                </gmd:CI_Address>
+                            </gmd:address>
+                        </gmd:CI_Contact>
+                    </gmd:contactInfo>
+                    <gmd:role>
+                        <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{ co.role }}{# tag="co.role",inboxmulti=1,name="Responsible party role",object="CI_ResponsibleParty()",ref="Part B 9.2",  multi = 0, group = "Responsible party", inbox="Responsible party",example="custodian", desc="function performed by the responsible party" #}" codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
+                    </gmd:role>
+                </gmd:CI_ResponsibleParty>
+            </gmd:pointOfContact>
       {% endfor -%}
-      {% for oc in md.identification.accessconstraints -%}{# tag="for oc in md.identification.otherconstraints" , group= "Constraints",inbox="Other restriction", inboxmulti=1  #}
-      <gmd:resourceConstraints>
-        <gmd:MD_LegalConstraints>
-          <gmd:accessConstraints>
-            <gmd:MD_RestrictionCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="{{ oc }}"{# tag="oc" , name="Other constraionts" , ref= "Part B 8.1" , desc= "Restrictions on the access and use of a resource or metadata" , example = "No conditions apply" , type ="CharacterString" ,group= "Constraints" , multi= 0, multiline= False,inbox="Other restriction", inboxmulti=1  #}></gmd:MD_RestrictionCode>
-          </gmd:accessConstraints>
-               {% endfor -%}
-      {% if md.identification.denominators|length > 0 -%}{# tag="if md.identification.denominators|length > 0", group = "Quality and Validity", inbox="Spatial resolution-scale",inboxmulti= 1 #}
-      {% for den in md.identification.denominators -%}{# tag="for den in md.identification.denominators", group = "Quality and Validity", inbox="Spatial resolution-scale",inboxmulti= 1 #}
-      <gmd:spatialResolution>
-        <gmd:MD_Resolution>
-          <gmd:equivalentScale>
-            <gmd:MD_RepresentativeFraction>
-              <gmd:denominator>
-                <gco:Integer>{{ den }}{# tag="den" , name="Equivalent scale" , ref= "Part B 6.2" , desc= "level of detail expressed as the scale denominator of a comparable hardcopy map or chart" , example = "50000 (e.g. 1:50000 scale map)" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-scale", multi=0 , inboxmulti=1, multiline= False #}</gco:Integer>
-              </gmd:denominator>
-            </gmd:MD_RepresentativeFraction>
-          </gmd:equivalentScale>
-        </gmd:MD_Resolution>
-      </gmd:spatialResolution>
-      {% endfor -%}
-      {% endif -%}
       {% if md.identification.distance|length > 0 -%}{# tag="if md.identification.distance|length > 0", group = "Quality and Validity", inbox="Spatial resolution-distance",inboxmulti= 1 #}
       {% for (d,u) in zip(md.identification.distance, md.identification.uom) -%}{# tag="for (d,u) in zip(md.identification.distance, md.identification.uom", group = "Quality and Validity", inbox="Spatial resolution-distance",inboxmulti= 1 #}
-      <gmd:spatialResolution>
-        <gmd:MD_Resolution>
-          <gmd:distance>
-            <gco:Distance uom="{{ u }}">{{ d }}{# tag="d" , name="Distance" , ref= "Part B 6.2" , desc= "Ground sample distance" , example = "25 meters" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-dostance", multi=0 , inboxmulti=1, multiline= False #}</gco:Distance>
-          </gmd:distance>
-        </gmd:MD_Resolution>
-      </gmd:spatialResolution>
+                    <gmd:spatialResolution>
+                        <gmd:MD_Resolution>
+                            <gmd:distance>
+                                <gco:Distance uom="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/uom/ML_gmxUom.xml#m">{{ d }}{# tag="d" , name="Distance" , ref= "Part B 6.2" , desc= "Ground sample distance" , example = "25" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-dostance", multi=0 , inboxmulti=1, multiline= False #}</gco:Distance>
+                            </gmd:distance>
+                        </gmd:MD_Resolution>
+                    </gmd:spatialResolution>
       {% endfor -%}
       {% endif -%}
       {% for lan in md.identification.resourcelanguage -%}{# tag="for lan in md.identification.resourcelanguage" , group= "Identification" ,inbox='Languages',inboxmulti=1, multiline= False #}
-      <gmd:language>
-        <gmd:LanguageCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ lan }}">{{ lan }}{# tag="lan" , name="Metadata language" , ref= "Part B 10.3" , desc= "Language used for documenting metadata." , example = "eng" , type ="LanguageCode (ISO/TS 19139)" ,multi=0,inbox='Languages',inboxmulti=1, group= "Identification" , multiline= False #}</gmd:LanguageCode>
-      </gmd:language>
+                    <gmd:language>
+                        <gmd:LanguageCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ lan }}{{ lan }}{# tag="lan" , name="Metadata language" , ref= "Part B 10.3" , desc= "Language used for documenting metadata." , example = "eng" , type ="LanguageCode (ISO/TS 19139)" ,multi=0,inbox='Languages',inboxmulti=1, group= "Identification" , multiline= False #}"></gmd:LanguageCode>
+                    </gmd:language>
       {% endfor -%}
-      <gmd:extent>
-        <gmd:EX_Extent>
-          <gmd:geographicElement>
-            <gmd:EX_GeographicBoundingBox>
-              <gmd:westBoundLongitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.minx }}{# tag="md.identification.extent.boundingBox.minx" , name="West Bound Longitude" , ref= "Part B 4.1" , desc= "Western-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "3.93" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:westBoundLongitude>
-              <gmd:eastBoundLongitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.maxx }}{# tag="md.identification.extent.boundingBox.maxx" , name="East Bound Longitude" , ref= "Part B 4.1" , desc= "Eastern-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "7.57" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:eastBoundLongitude>
-              <gmd:southBoundLatitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.miny }}{# tag="md.identification.extent.boundingBox.miny" , name="South Bound Latitude" , ref= "Part B 4.1" , desc= "Southern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "52.10" , type ="Decimal" , group= "Geographic" ,multi=0 , multiline= False #}</gco:Decimal>
-              </gmd:southBoundLatitude>
-              <gmd:northBoundLatitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.maxy }}{# tag="md.identification.extent.boundingBox.maxy" , name="North Bound Latitude" , ref= "Part B 4.1" , desc= "Northern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "54.10" , type ="Decimal" , group= "Geographic" , multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:northBoundLatitude>
-            </gmd:EX_GeographicBoundingBox>
-          </gmd:geographicElement>
-        </gmd:EX_Extent>
-      </gmd:extent>
-    </gmd:MD_DataIdentification>
-  </gmd:identificationInfo>
-  <gmd:distributionInfo>
-    <gmd:MD_Distribution>
-      <gmd:distributionFormat>
-        <gmd:MD_Format>
-          <gmd:name gco:nilReason="inapplicable"/>
-          <gmd:version gco:nilReason="inapplicable"/>
-        </gmd:MD_Format>
-      </gmd:distributionFormat>
-      <gmd:transferOptions>
-        <gmd:MD_DigitalTransferOptions>
-          {% for ln in md.distribution.online -%}{# tag="for ln in md.distribution.online" , group= "Identification",object='CI_OnlineResource()'  #}
-          <gmd:onLine>
-            <gmd:CI_OnlineResource>
-              <gmd:linkage>
-                <gmd:URL>{{ ln.url }}{# tag="ln.url" , name="Linkage" , ref= "Part B 1.4" ,object='CI_OnlineResource()', desc= "Location (address) for on-line access using a Uniform Resource Locator address or similar addressing scheme." , example = "http://image2000.jrc.it" , type ="URL" , group= "Identification" ,multi=1, multiline= False #}</gmd:URL>
-              </gmd:linkage>
-            </gmd:CI_OnlineResource>
-          </gmd:onLine>
-          {% endfor -%}
-        </gmd:MD_DigitalTransferOptions>
-      </gmd:transferOptions>
-    </gmd:MD_Distribution>
-  </gmd:distributionInfo>
-  <gmd:dataQualityInfo>
-    <gmd:DQ_DataQuality>
-      <gmd:scope>
-        <gmd:DQ_Scope>
-          <gmd:level>
-            <gmd:MD_ScopeCode codeListValue="{{ md.identification.identtype }}"{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #} codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_ScopeCode"></gmd:MD_ScopeCode>
-          </gmd:level>
-        </gmd:DQ_Scope>
-      </gmd:scope>
-    </gmd:DQ_DataQuality>
-  </gmd:dataQualityInfo>
-</gmd:MD_Metadata>
+                    <gmd:extent>
+                        <gmd:EX_Extent>
+                            <gmd:geographicElement>
+                                <gmd:EX_GeographicBoundingBox>
+                                    <gmd:westBoundLongitude>
+                                        <gco:Decimal>{{ md.identification.extent.boundingBox.minx }}{# tag="md.identification.extent.boundingBox.minx" , name="West Bound Longitude" , ref= "Part B 4.1" , desc= "Western-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "3.93" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
+                                    </gmd:westBoundLongitude>
+                                    <gmd:eastBoundLongitude>
+                                        <gco:Decimal>{{ md.identification.extent.boundingBox.maxx }}{# tag="md.identification.extent.boundingBox.maxx" , name="East Bound Longitude" , ref= "Part B 4.1" , desc= "Eastern-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "7.57" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
+                                    </gmd:eastBoundLongitude>
+                                    <gmd:southBoundLatitude>
+                                        <gco:Decimal>{{ md.identification.extent.boundingBox.miny }}{# tag="md.identification.extent.boundingBox.miny" , name="South Bound Latitude" , ref= "Part B 4.1" , desc= "Southern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "52.10" , type ="Decimal" , group= "Geographic" ,multi=0 , multiline= False #}</gco:Decimal>
+                                    </gmd:southBoundLatitude>
+                                    <gmd:northBoundLatitude>
+                                        <gco:Decimal>{{ md.identification.extent.boundingBox.maxy }}{# tag="md.identification.extent.boundingBox.maxy" , name="North Bound Latitude" , ref= "Part B 4.1" , desc= "Northern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "54.10" , type ="Decimal" , group= "Geographic" , multi=0 ,  multiline= False #}</gco:Decimal>
+                                    </gmd:northBoundLatitude>
+                                </gmd:EX_GeographicBoundingBox>
+                            </gmd:geographicElement>
+                        </gmd:EX_Extent>
+                    </gmd:extent>
+                </gmd:MD_DataIdentification>
+            </gmd:identificationInfo>
+            <gmd:distributionInfo>
+                <gmd:MD_Distribution>
+                    <gmd:distributionFormat>
+                        <gmd:MD_Format>
+                            <gmd:name gco:nilReason="inapplicable"/>
+                            <gmd:version gco:nilReason="inapplicable"/>
+                        </gmd:MD_Format>
+                    </gmd:distributionFormat>
+                    <gmd:transferOptions>
+                        <gmd:MD_DigitalTransferOptions>
+                          {% for ln in md.distribution.online -%}{# tag="for ln in md.distribution.online" , group= "Identification",object='CI_OnlineResource()'  #}
+                            <gmd:onLine>
+                                <gmd:CI_OnlineResource>
+                                    <gmd:linkage>
+                                        <gmd:URL>{{ ln.url }}{# tag="ln.url" , name="Linkage" , ref= "Part B 1.4" ,object='CI_OnlineResource()', desc= "Location (address) for on-line access using a Uniform Resource Locator address or similar addressing scheme." , example = "http://image2000.jrc.it" , type ="URL" , group= "Identification" ,multi=1, multiline= False #}</gmd:URL>
+                                    </gmd:linkage>
+                                </gmd:CI_OnlineResource>
+                            </gmd:onLine>
+                           {% endfor -%}
+                        </gmd:MD_DigitalTransferOptions>
+                    </gmd:transferOptions>
+                </gmd:MD_Distribution>
+            </gmd:distributionInfo>
+            <gmd:dataQualityInfo>
+                <gmd:DQ_DataQuality>
+                    <gmd:scope>
+                        <gmd:DQ_Scope>
+                            <gmd:level>
+                                <gmd:MD_ScopeCode codeListValue="{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #}" codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_ScopeCode"></gmd:MD_ScopeCode>
+                            </gmd:level>
+                        </gmd:DQ_Scope>
+                    </gmd:scope>
+                </gmd:DQ_DataQuality>
+            </gmd:dataQualityInfo>
+        </gmd:MD_Metadata>

Modified: sandbox/krejcmat/src/templates/grassInspireTemplateFinal.xml
===================================================================
--- sandbox/krejcmat/src/templates/grassInspireTemplateFinal.xml	2014-07-30 15:06:54 UTC (rev 61460)
+++ sandbox/krejcmat/src/templates/grassInspireTemplateFinal.xml	2014-07-30 15:17:01 UTC (rev 61461)
@@ -1,322 +1,324 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- ISO 19115:2003 file created from OWSLib object model -->
 <gmd:MD_Metadata xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink">
-  <gmd:fileIdentifier>
-    <gco:CharacterString>{{ md.identifier }}{# tag="md.identifier",ref="Part B 1.5",  name ="Resource Identifier", desc ="Unique Resource Identifier", example ="286c0725-046e-4533-b0bf-d6e367f6c342", type = "CharacterString", multi = 0, group = "Identification", multiline=False #}</gco:CharacterString>
-  </gmd:fileIdentifier>
-  <gmd:language>
-    <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ md.languagecode }}">{# tag="md.languagecode", name ="Metadata language", desc ="Language(s) used within the datasets", example ="eng", type = "CharacterString", multi = 0, group = "Metadata",multiline=False #}</gmd:LanguageCode>
-  </gmd:language>
-  <gmd:hierarchyLevel>
-    <gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #}</gmd:MD_ScopeCode>
-  </gmd:hierarchyLevel>
+    <gmd:fileIdentifier>
+        <gco:CharacterString>{{ md.identifier }}{# tag="md.identifier",ref="Part B 1.5",  name ="Resource Identifier", desc ="Unique Resource Identifier", example ="286c0725-046e-4533-b0bf-d6e367f6c342", type = "CharacterString", multi = 0, group = "Identification", multiline=False #}</gco:CharacterString>
+    </gmd:fileIdentifier>
+    <gmd:language>
+        <gmd:LanguageCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ md.languagecode }}{# tag="md.languagecode", name ="Metadata language", desc ="Language(s) used within the datasets", example ="eng", type = "CharacterString", multi = 0, group = "Metadata",multiline=False #}"></gmd:LanguageCode>
+    </gmd:language>
+    <gmd:hierarchyLevel>
+        <gmd:MD_ScopeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset" codeSpace="ISOTC211/19115">{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=False #}</gmd:MD_ScopeCode>
+    </gmd:hierarchyLevel>
   {% for co in md.contact -%}{# tag="for co in md.contact",  inboxmulti = 1, group = "Metadata",inbox="Metadata point of contact",object="CI_ResponsibleParty()" #}
-  <gmd:contact>
-    <gmd:CI_ResponsibleParty>
-      <gmd:organisationName>
-        <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  inboxmulti = 1,multi = 0, group = "Metadata",object="CI_ResponsibleParty()", inbox="Metadata point of contact",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
-      </gmd:organisationName>
-      <gmd:contactInfo>
-        <gmd:CI_Contact>
-          <gmd:address>
-            <gmd:CI_Address>
-              <gmd:electronicMailAddress>
-                <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1",  multi = 0,object="CI_ResponsibleParty()", inboxmulti = 1,group = "Metadata", inbox="Metadata point of contact",example="image2000 at jrc.it", desc="Party responsible for the metadata information." #}</gco:CharacterString>
-              </gmd:electronicMailAddress>
-            </gmd:CI_Address>
-          </gmd:address>
-        </gmd:CI_Contact>
-      </gmd:contactInfo>
-      <gmd:role>
-        <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{  co.role }}"{# tag="co.role",name="Responsible party role",ref="Part B 9.2" , multi = 0, inboxmulti = 1,group = "Responsible party",object="CI_ResponsibleParty()", inbox="Metadata pointt of contact",example="custodian", desc="function performed by the responsible party" #} codeSpace="ISOTC211/19115">
-</gmd:CI_RoleCode>
-      </gmd:role>
-    </gmd:CI_ResponsibleParty>
-  </gmd:contact>
+    <gmd:contact>
+        <gmd:CI_ResponsibleParty>
+            <gmd:organisationName>
+                <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  inboxmulti = 1,multi = 0, group = "Metadata",object="CI_ResponsibleParty()", inbox="Metadata point of contact",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
+            </gmd:organisationName>
+            <gmd:contactInfo>
+                <gmd:CI_Contact>
+                    <gmd:address>
+                        <gmd:CI_Address>
+                            <gmd:electronicMailAddress>
+                                <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1",  multi = 0,object="CI_ResponsibleParty()", inboxmulti = 1,group = "Metadata", inbox="Metadata point of contact",example="image2000 at jrc.it", desc="Party responsible for the metadata information." #}</gco:CharacterString>
+                            </gmd:electronicMailAddress>
+                        </gmd:CI_Address>
+                    </gmd:address>
+                </gmd:CI_Contact>
+            </gmd:contactInfo>
+            <gmd:role>
+                <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{  co.role }}{# tag="co.role",name="Responsible party role",ref="Part B 9.2" , multi = 0, inboxmulti = 1,group = "Responsible party",object="CI_ResponsibleParty()", inbox="Metadata pointt of contact",example="custodian", desc="function performed by the responsible party" #}" codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
+            </gmd:role>
+        </gmd:CI_ResponsibleParty>
+    </gmd:contact>
   {% endfor -%}
-  <gmd:dateStamp>
-    <gco:Date>{{ md.datestamp }}{# tag="md.datestamp" , name="Metadata date" , ref= "Part B 10.2" , desc= "Date that the metadata was created." , example = "2005-03-27" , type ="Date" , multi= 0 , group= "Metadata" , multiline= False #}</gco:Date>
-  </gmd:dateStamp>
-  <gmd:metadataStandardName>
-    <gco:CharacterString>ISO 19115</gco:CharacterString>
-  </gmd:metadataStandardName>
-  <gmd:metadataStandardVersion>
-    <gco:CharacterString>2003/Cor.1:2006</gco:CharacterString>
-  </gmd:metadataStandardVersion>
-  <gmd:identificationInfo>
-    <gmd:MD_DataIdentification>
-      <gmd:citation>
-        <gmd:CI_Citation>
-          <gmd:title>
-            <gco:CharacterString>{{ md.identification.title }}{# tag="md.identification.title", ref="Part B 1.1", name ="Resource title", desc ="Name by which the cited resource is known.", example ="Image2000 Product 1 (nl2) MultispectB 10.1" , multi = 0, group ="Identification", type = "CharacterString", multiline=False #}</gco:CharacterString>
-          </gmd:title>
+    <gmd:dateStamp>
+        <gco:Date>{{ md.datestamp }}{# tag="md.datestamp" , name="Metadata date" , ref= "Part B 10.2" , desc= "Date that the metadata was created." , example = "2005-03-27" , type ="Date" , multi= 0 , group= "Metadata" , multiline= False #}</gco:Date>
+    </gmd:dateStamp>
+    <gmd:metadataStandardName>
+        <gco:CharacterString>ISO 19115</gco:CharacterString>
+    </gmd:metadataStandardName>
+    <gmd:metadataStandardVersion>
+        <gco:CharacterString>2003/Cor.1:2006</gco:CharacterString>
+    </gmd:metadataStandardVersion>
+    <gmd:identificationInfo>
+        <gmd:MD_DataIdentification>
+            <gmd:citation>
+                <gmd:CI_Citation>
+                    <gmd:title>
+                        <gco:CharacterString>{{ md.identification.title }}{# tag="md.identification.title", ref="Part B 1.1", name ="Resource title", desc ="Name by which the cited resource is known.", example ="Image2000 Product 1 (nl2) MultispectB 10.1" , multi = 0, group ="Identification", type = "CharacterString", multiline=False #}</gco:CharacterString>
+                    </gmd:title>
           {% for d in md.identification.date -%}{# tag="for d in md.identification.date" ,name="",object="CI_Date()",group= "Temporal" , inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False #}
-          <gmd:date>
-            <gmd:CI_Date>
-              <gmd:date>
-                <gco:DateTime>{{ d.date }}{# tag="d.date" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="Date of: type(below)",desc="reference date for the cited resource – publication/creation/revision",example="2007-09-15" #}</gco:DateTime>
-              </gmd:date>
-              <gmd:dateType>
-                <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ d.type }}"{# tag="d.type" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="type: creation/publication/revision",desc="reference date for the cited resource – publication/creation/revision",example="creation" #}
- codeSpace="ISOTC211/19115"></gmd:CI_DateTypeCode>
-              </gmd:dateType>
-            </gmd:CI_Date>
-          </gmd:date>
+                    <gmd:date>
+                        <gmd:CI_Date>
+                            <gmd:date>
+                                <gco:DateTime>{{ d.date }}{# tag="d.date" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="Date of: type(below)",desc="reference date for the cited resource - publication/creation/revision",example="2007-09-15" #}</gco:DateTime>
+                            </gmd:date>
+                            <gmd:dateType>
+                                <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ d.type }}{# tag="d.type" , group= "Temporal" ,object="CI_Date()", inbox= "Date of creation/publication/revision",  inboxmulti=1, multiline= False, name="type: creation/publication/revision",desc="reference date for the cited resource - publication/creation/revision",example="creation" #}"
+codeSpace="ISOTC211/19115"></gmd:CI_DateTypeCode>
+                            </gmd:dateType>
+                        </gmd:CI_Date>
+                    </gmd:date>
           {% endfor -%}
 {% for (cod,code) in zip(md.identification.uricode,md.identification.uricodespace) -%}{# tag="for (cod,code) in zip(md.identification.uricode,md.identification.uricodespace)", inboxmulti=1, group = "Identification",inbox="Unique resource identifier" #}
-<gmd:extent>
-<gmd:EX_Extent>
-<gmd:geographicElement>
-<gmd:EX_GeographicDescription>
-<gmd:geographicIdentifier>
-<gmd:RS_Identifier>
-<gmd:code>
-<gco:CharacterString>{{ cod }}{# tag="cod", inboxmulti=1, group = "Identification",inbox="Unique resource identifier" ,ref="Part B 1.5",  name ="Idetifier- code", desc ="A value uniquely identifying the resource.The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).", example ="http://image2000.jrc.it # image2000_1_nl2_multi", type = "CharacterString", multi = 0  #}</gco:CharacterString>
-</gmd:code>
-<gmd:codeSpace>
-<gco:CharacterString>{{ code }}{# tag="cod", inboxmulti=1, group = "Identification",inbox="Unique resource identifier" ,ref="Part B 1.5",  name ="Idetifier- code space", desc ="A value uniquely identifying the resource.The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).", example ="http://image2000.jrc.it", type = "CharacterString", multi = 0 #}</gco:CharacterString>
-</gmd:codeSpace>
-</gmd:RS_Identifier>
-</gmd:geographicIdentifier>
-</gmd:EX_GeographicDescription>
-</gmd:geographicElement>
-</gmd:EX_Extent>
-</gmd:extent>
+                    <gmd:extent>
+                        <gmd:EX_Extent>
+                            <gmd:geographicElement>
+                                <gmd:EX_GeographicDescription>
+                                    <gmd:geographicIdentifier>
+                                        <gmd:RS_Identifier>
+                                            <gmd:code>
+                                                <gco:CharacterString>{{ cod }}{# tag="cod", inboxmulti=1, group = "Identification",inbox="Unique resource identifier" ,ref="Part B 1.5",  name ="Idetifier- code", desc ="A value uniquely identifying the resource.The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).", example ="http://image2000.jrc.it # image2000_1_nl2_multi", type = "CharacterString", multi = 0  #}</gco:CharacterString>
+                                            </gmd:code>
+                                            <gmd:codeSpace>
+                                                <gco:CharacterString>{{ code }}{# tag="cod", inboxmulti=1, group = "Identification",inbox="Unique resource identifier" ,ref="Part B 1.5",  name ="Idetifier- code space", desc ="A value uniquely identifying the resource.The value domain of this metadata element is a mandatory character string code, generally assigned by the data owner, and a character string namespace uniquely identifying the context of the identifier code (for example, the data owner).", example ="http://image2000.jrc.it", type = "CharacterString", multi = 0 #}</gco:CharacterString>
+                                            </gmd:codeSpace>
+                                        </gmd:RS_Identifier>
+                                    </gmd:geographicIdentifier>
+                                </gmd:EX_GeographicDescription>
+                            </gmd:geographicElement>
+                        </gmd:EX_Extent>
+                    </gmd:extent>
   {% endfor -%}
-        </gmd:CI_Citation>
-      </gmd:citation>
-      <gmd:abstract>
-        <gco:CharacterString>{{ md.identification.abstract }}{# tag="md.identification.abstract ",ref="Part B 1.2",  name ="Resource Abstract", desc ="Brief narrative summary of the content of the resource(s).", example ="IMAGE2000 product 1 individual orthorectified scenes. IMAGE2000 was produced from ETM+ Landsat 7 satellite data and provides a consistent European coverage of individual orthorectified scenes in national map projection systems. The year 2000 was targeted as reference year, but a deviation of maximum 1-year was allowed to obtain a full coverage of Europe, which involves approximately 450 Landsat TM Frames. Where Landsat 7 data were not available, Landsat 5 data have been used instead. The spatial resolution is 25 metres for multispectral and 12.5 metres for panchromatic imagery", type = "CharacterString", multi = 0, group = "Identification", multiline=True #}</gco:CharacterString>
-      </gmd:abstract>
+                </gmd:CI_Citation>
+            </gmd:citation>
+            <gmd:abstract>
+                <gco:CharacterString>{{ md.identification.abstract }}{# tag="md.identification.abstract ",ref="Part B 1.2",  name ="Resource Abstract", desc ="Brief narrative summary of the content of the resource(s).", example ="IMAGE2000 product 1 individual orthorectified scenes. IMAGE2000 was produced from ETM+ Landsat 7 satellite data and provides a consistent European coverage of individual orthorectified scenes in national map projection systems. The year 2000 was targeted as reference year, but a deviation of maximum 1-year was allowed to obtain a full coverage of Europe, which involves approximately 450 Landsat TM Frames. Where Landsat 7 data were not available, Landsat 5 data have been used instead. The spatial resolution is 25 metres for multispectral and 12.5 metres for panchromatic imagery", type = "CharacterString", multi = 0, group = "Identification", multiline=True #}</gco:CharacterString>
+            </gmd:abstract>
       {% for co in md.identification.contact -%}{# tag="for co in md.identification.contact",object="CI_ResponsibleParty()", inboxmulti=1, group = "Responsible party",inbox="Point of contact" #}
-      <gmd:pointOfContact>
-        <gmd:CI_ResponsibleParty>
-          <gmd:organisationName>
-            <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  multi = 0, group = "Responsible party",inboxmulti=1 ,inbox="Point of contact",object="CI_ResponsibleParty()",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
-          </gmd:organisationName>
-          <gmd:contactInfo>
-            <gmd:CI_Contact>
-              <gmd:address>
-                <gmd:CI_Address>
-                  <gmd:electronicMailAddress>
-                    <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1" , group = "Metadata",inboxmulti=1, inbox="Responsible party",multi=0,example="image2000 at jrc.it",object="CI_ResponsibleParty()", desc="Party responsible for the metadata information." #}</gco:CharacterString>
-                  </gmd:electronicMailAddress>
-                </gmd:CI_Address>
-              </gmd:address>
-            </gmd:CI_Contact>
-          </gmd:contactInfo>
-          <gmd:role>
-            <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{ co.role }}"{# tag="co.role",inboxmulti=1,name="Responsible party role",object="CI_ResponsibleParty()",ref="Part B 9.2",  multi = 0, group = "Responsible party", inbox="Responsible party",example="custodian", desc="function performed by the responsible party" #} codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
-          </gmd:role>
-        </gmd:CI_ResponsibleParty>
-      </gmd:pointOfContact>
+      
+            <gmd:pointOfContact>
+                <gmd:CI_ResponsibleParty>
+                    <gmd:organisationName>
+                        <gco:CharacterString>{{ co.organization }}{# tag="co.organization",ref="Part B 9.1",  multi = 0, group = "Responsible party",inboxmulti=1 ,inbox="Point of contact",object="CI_ResponsibleParty()",name="Organisation name",example="SDI Unit, Institute for Environment and Sustainability, Joint ResearchCentre",desc="identification of, and means of communication with, person(s) and organization(s) associated with theresource(s)" #}</gco:CharacterString>
+                    </gmd:organisationName>
+                    <gmd:contactInfo>
+                        <gmd:CI_Contact>
+                            <gmd:address>
+                                <gmd:CI_Address>
+                                    <gmd:electronicMailAddress>
+                                        <gco:CharacterString>{{ co.email }}{# tag="co.email",name="E-mail",ref="Part B 10.1" , group = "Metadata",inboxmulti=1, inbox="Responsible party",multi=0,example="image2000 at jrc.it",object="CI_ResponsibleParty()", desc="Party responsible for the metadata information." #}</gco:CharacterString>
+                                    </gmd:electronicMailAddress>
+                                </gmd:CI_Address>
+                            </gmd:address>
+                        </gmd:CI_Contact>
+                    </gmd:contactInfo>
+                    <gmd:role>
+                        <gmd:CI_RoleCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="{{ co.role }}{# tag="co.role",inboxmulti=1,name="Responsible party role",object="CI_ResponsibleParty()",ref="Part B 9.2",  multi = 0, group = "Responsible party", inbox="Responsible party",example="custodian", desc="function performed by the responsible party" #}" codeSpace="ISOTC211/19115"></gmd:CI_RoleCode>
+                    </gmd:role>
+                </gmd:CI_ResponsibleParty>
+            </gmd:pointOfContact>
       {% endfor -%}
-      {% for k in md.identification.keywords -%}{# tag="for k in md.identification.keywords" ,group = "Keywords",inbox="Free keywords",inboxmulti=1 #}
-      <gmd:descriptiveKeywords>
-        <gmd:MD_Keywords>
+
+{% for k in md.identification.keywords -%}{# tag="for k in md.identification.keywords" ,group = "Keywords",inbox="Free keywords",inboxmulti=1 #}
+
+<gmd:descriptiveKeywords>
+                <gmd:MD_Keywords>
           {% for kw in k["keywords"] -%}{# tag='for kw in k["keywords"]',group = "Keywords",inbox="Free keywords",inboxmulti=1 #}
-          <gmd:keyword>
-            <gco:CharacterString>{{ kw }}{# tag="kw",ref="Part B 3.1", name ="Keyword",example="Land cover (INSPIRE Spatial Data Theme),humanCatalogueViewer (spatial data service,subcategory), water springs (AGROVOC), freshwater (GEMET Concepts)", desc ="Commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject." , type = "CharacterString",inboxmulti=1, multi = 1, group = "Keywords", multiline=False, inbox="Free keywords" #} </gco:CharacterString>
-          </gmd:keyword>
+                    <gmd:keyword>
+                        <gco:CharacterString>{{ kw }}{# tag="kw",ref="Part B 3.1", name ="Keyword",example="Land cover (INSPIRE Spatial Data Theme),humanCatalogueViewer (spatial data service,subcategory), water springs (AGROVOC), freshwater (GEMET Concepts)", desc ="Commonly used word(s) or formalised word(s) or phrase(s) used to describe the subject." , type = "CharacterString",inboxmulti=1, multi = 1, group = "Keywords", multiline=False, inbox="Free keywords" #} </gco:CharacterString>
+                    </gmd:keyword>
           {% endfor -%}
-          <gmd:thesaurusName>
-            <gmd:CI_Citation>
-              <gmd:title>
-                <gco:CharacterString>{{ k["thesaurus"]["title"] }}{# tag='k["thesaurus"]["title"]', name ="Title", desc ="This citation shall include title of keywords )" , type = "CharacterString", multi = 0,inboxmulti=1, group = "Keywords", multiline=False, inbox="Free keywords" #}</gco:CharacterString>
-              </gmd:title>
-              <gmd:date>
-                <gmd:CI_Date>
-                  <gmd:date>
-                    <gco:Date>{{ k["thesaurus"]["date"] }}{# tag='k["thesaurus"]["date"]', name ="Reference adate", desc ="This citation shall include at least the title a reference date(publication, revision, creation." , type = "CharacterString",inboxmulti=1, multi = 0, group = "Keywords", multiline=False, inbox="Free keywords" #}</gco:Date>
-                  </gmd:date>
-                  <gmd:dateType>
-                    <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ k["thesaurus"]["datetype"] }}">{{ k["thesaurus"]["datetype"] }}{# tag='k["thesaurus"]["datetype"]', name ="Date type",inboxmulti=1, desc ="Options: Date of creation, Date of last revision, date of publication" , multi = 0, group = "Keywords", multiline=False, inbox="Free keywords" #}</gmd:CI_DateTypeCode>
-                  </gmd:dateType>
-                </gmd:CI_Date>
-              </gmd:date>
-            </gmd:CI_Citation>
-          </gmd:thesaurusName>
-        </gmd:MD_Keywords>
-      </gmd:descriptiveKeywords>
+                    <gmd:thesaurusName>
+                        <gmd:CI_Citation>
+                            <gmd:title>
+                                <gco:CharacterString>{{ k["thesaurus"]["title"] }}{# tag='k["thesaurus"]["title"]', name ="Title", desc ="This citation shall include title of keywords )" , type = "CharacterString", multi = 0,inboxmulti=1, group = "Keywords", multiline=False, inbox="Free keywords" #}</gco:CharacterString>
+                            </gmd:title>
+                            <gmd:date>
+                                <gmd:CI_Date>
+                                    <gmd:date>
+                                        <gco:Date>{{ k["thesaurus"]["date"] }}{# tag='k["thesaurus"]["date"]', name ="Reference date", desc ="This citation shall include at least the title a reference date(publication, revision, creation." , type = "CharacterString",inboxmulti=1, multi = 0, group = "Keywords", multiline=False, inbox="Free keywords" #}</gco:Date>
+                                    </gmd:date>
+                                    <gmd:dateType>
+                                        <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ k["thesaurus"]["datetype"] }}{{ k["thesaurus"]["datetype"] }}{# tag='k["thesaurus"]["datetype"]', name ="Date type",inboxmulti=1, desc ="Options: Date of creation, Date of last revision, date of publication" , multi = 0, group = "Keywords", multiline=False, inbox="Free keywords" #}"></gmd:CI_DateTypeCode>
+                                    </gmd:dateType>
+                                </gmd:CI_Date>
+                            </gmd:date>
+                        </gmd:CI_Citation>
+                    </gmd:thesaurusName>
+                </gmd:MD_Keywords>
+            </gmd:descriptiveKeywords>
       {% endfor -%}
       {% for rc in md.identification.uselimitation -%}{# tag="for rc in md.identification.uselimitation" , group= "Constraints" ,inbox="Condition applying to access and use", inboxmulti=1 #}
-      <gmd:resourceConstraints>
-        <gmd:MD_Constraints>
-          <gmd:useLimitation>
-            <gco:CharacterString>{{ rc }}{# tag="rc" , name="Use limitation" , ref= "Part B 8.1" , desc= "restrictions on the access and use of a resource or metadata" , example = "no conditions apply" , type ="CharacterString" ,group= "Constraints" , multi= 0, multiline= False,inbox="Condition applying to access and use", inboxmulti=1  #}</gco:CharacterString>
-          </gmd:useLimitation>
-        </gmd:MD_Constraints>
-      </gmd:resourceConstraints>
+            <gmd:resourceConstraints>
+                <gmd:MD_Constraints>
+                    <gmd:useLimitation>
+                        <gco:CharacterString>{{ rc }}{# tag="rc" , name="Use limitation" , ref= "Part B 8.1" , desc= "restrictions on the access and use of a resource or metadata" , example = "no conditions apply" , type ="CharacterString" ,group= "Constraints" , multi= 0, multiline= False,inbox="Condition applying to access and use", inboxmulti=1  #}</gco:CharacterString>
+                    </gmd:useLimitation>
+                </gmd:MD_Constraints>
+            </gmd:resourceConstraints>
       {% endfor -%}
       {% for oc in md.identification.accessconstraints -%}{# tag="for oc in md.identification.otherconstraints" , group= "Constraints",inbox="Other restriction", inboxmulti=1  #}
-      <gmd:resourceConstraints>
-        <gmd:MD_LegalConstraints>
-          <gmd:accessConstraints>
-            <gmd:MD_RestrictionCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="{{ oc }}"{# tag="oc" , name="Other constraionts" , ref= "Part B 8.1" , desc= "Restrictions on the access and use of a resource or metadata" , example = "No conditions apply" , type ="CharacterString" ,group= "Constraints" , multi= 0, multiline= False,inbox="Other restriction", inboxmulti=1  #}></gmd:MD_RestrictionCode>
-          </gmd:accessConstraints>
+            <gmd:resourceConstraints>
+                <gmd:MD_LegalConstraints>
+                    <gmd:accessConstraints>
+                        <gmd:MD_RestrictionCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_RestrictionCode" codeListValue="{{ oc }}{# tag="oc" , name="Other constraionts" , ref= "Part B 8.1" , desc= "Restrictions on the access and use of a resource or metadata" , example = "No conditions apply" , type ="CharacterString" ,group= "Constraints" , multi= 0, multiline= False,inbox="Other restriction", inboxmulti=1  #}"></gmd:MD_RestrictionCode>
+                    </gmd:accessConstraints>
                {% endfor -%}
       {% for ac in md.identification.accessconstraints -%}{# tag="for oc in md.identification.accessconstraints" , group= "Constraints",inbox="Limitation on public access", inboxmulti=1  #}
-          <gmd:otherConstraints>
-                  <gco:CharacterString>{{ ac }} {# tag="ac" ,name="Access constraints", group= "Constraints",inbox="Limitations on public access", inboxmulti=1,ref= "Part B 8.2" , desc= "access constraints applied to assure the protection of privacy or intellectual property, and any special restrictionsor limitations on obtaining the resource." , example = "intellectualPropertyRights (rights to financial benefit from and control of distribution of non tangible property that is a result of creativity)." , type ="CharacterString", multi=0 ,  multiline= False #}</gco:CharacterString>
-               </gmd:otherConstraints>
-        </gmd:MD_LegalConstraints>
-      </gmd:resourceConstraints>
+                    <gmd:otherConstraints>
+                        <gco:CharacterString>{{ ac }} {# tag="ac" ,name="Access constraints", group= "Constraints",inbox="Limitations on public access", inboxmulti=1,ref= "Part B 8.2" , desc= "access constraints applied to assure the protection of privacy or intellectual property, and any special restrictionsor limitations on obtaining the resource." , example = "intellectualPropertyRights (rights to financial benefit from and control of distribution of non tangible property that is a result of creativity)." , type ="CharacterString", multi=0 ,  multiline= False #}</gco:CharacterString>
+                    </gmd:otherConstraints>
+                </gmd:MD_LegalConstraints>
+            </gmd:resourceConstraints>
       {% endfor -%}
       {% if md.identification.denominators|length > 0 -%}{# tag="if md.identification.denominators|length > 0", group = "Quality and Validity", inbox="Spatial resolution-scale",inboxmulti= 1 #}
-      {% for den in md.identification.denominators -%}{# tag="for den in md.identification.denominators", group = "Quality and Validity", inbox="Spatial resolution-scale",inboxmulti= 1 #}
-      <gmd:spatialResolution>
-        <gmd:MD_Resolution>
-          <gmd:equivalentScale>
-            <gmd:MD_RepresentativeFraction>
-              <gmd:denominator>
-                <gco:Integer>{{ den }}{# tag="den" , name="Equivalent scale" , ref= "Part B 6.2" , desc= "level of detail expressed as the scale denominator of a comparable hardcopy map or chart" , example = "50000 (e.g. 1:50000 scale map)" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-scale", multi=0 , inboxmulti=1, multiline= False #}</gco:Integer>
-              </gmd:denominator>
-            </gmd:MD_RepresentativeFraction>
-          </gmd:equivalentScale>
-        </gmd:MD_Resolution>
-      </gmd:spatialResolution>
+{% for den in md.identification.denominators -%}{# tag="for den in md.identification.denominators", group = "Quality and Validity", inbox="Spatial resolution-scale",inboxmulti= 1 #}
+            <gmd:spatialResolution>
+                <gmd:MD_Resolution>
+                    <gmd:equivalentScale>
+                        <gmd:MD_RepresentativeFraction>
+                            <gmd:denominator>
+                                <gco:Integer>{{ den }}{# tag="den" , name="Equivalent scale" , ref= "Part B 6.2" , desc= "level of detail expressed as the scale denominator of a comparable hardcopy map or chart" , example = "50000 (e.g. 1:50000 scale map)" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-scale", multi=0 , inboxmulti=1, multiline= False #}</gco:Integer>
+                            </gmd:denominator>
+                        </gmd:MD_RepresentativeFraction>
+                    </gmd:equivalentScale>
+                </gmd:MD_Resolution>
+            </gmd:spatialResolution>
       {% endfor -%}
       {% endif -%}
       {% if md.identification.distance|length > 0 -%}{# tag="if md.identification.distance|length > 0", group = "Quality and Validity", inbox="Spatial resolution-distance",inboxmulti= 1 #}
       {% for (d,u) in zip(md.identification.distance, md.identification.uom) -%}{# tag="for (d,u) in zip(md.identification.distance, md.identification.uom", group = "Quality and Validity", inbox="Spatial resolution-distance",inboxmulti= 1 #}
-      <gmd:spatialResolution>
-        <gmd:MD_Resolution>
-          <gmd:distance>
-            <gco:Distance uom="{{ u }}">{{ d }}{# tag="d" , name="Distance" , ref= "Part B 6.2" , desc= "Ground sample distance" , example = "25 meters" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-dostance", multi=0 , inboxmulti=1, multiline= False #}</gco:Distance>
-          </gmd:distance>
-        </gmd:MD_Resolution>
-      </gmd:spatialResolution>
+                    <gmd:spatialResolution>
+                        <gmd:MD_Resolution>
+                            <gmd:distance>
+                                <gco:Distance uom="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/uom/ML_gmxUom.xml#m">{{ d }}{# tag="d" , name="Distance" , ref= "Part B 6.2" , desc= "Ground sample distance" , example = "25" , type ="Integer" , group = "Quality and Validity" ,inbox="Spatial resolution-dostance", multi=0 , inboxmulti=1, multiline= False #}</gco:Distance>
+                            </gmd:distance>
+                        </gmd:MD_Resolution>
+                    </gmd:spatialResolution>
       {% endfor -%}
       {% endif -%}
       {% for lan in md.identification.resourcelanguage -%}{# tag="for lan in md.identification.resourcelanguage" , group= "Identification" ,inbox='Languages',inboxmulti=1, multiline= False #}
-      <gmd:language>
-        <gmd:LanguageCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ lan }}">{{ lan }}{# tag="lan" , name="Metadata language" , ref= "Part B 10.3" , desc= "Language used for documenting metadata." , example = "eng" , type ="LanguageCode (ISO/TS 19139)" ,multi=0,inbox='Languages',inboxmulti=1, group= "Identification" , multiline= False #}</gmd:LanguageCode>
-      </gmd:language>
+            <gmd:language>
+                <gmd:LanguageCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#LanguageCode" codeListValue="{{ lan }}{{ lan }}{# tag="lan" , name="Metadata language" , ref= "Part B 10.3" , desc= "Language used for documenting metadata." , example = "eng" , type ="LanguageCode (ISO/TS 19139)" ,multi=0,inbox='Languages',inboxmulti=1, group= "Identification" , multiline= False #}"></gmd:LanguageCode>
+            </gmd:language>
       {% endfor -%}
       {% for tc in md.identification.topiccategory -%}{# tag="for tc in md.identification.topiccategory", inbox='Topic category',group= "Classification", multiline= False #}
-      <gmd:topicCategory>
-        <gmd:MD_TopicCategoryCode>{{ tc }}{# tag="tc" , name="Topic" , ref= "Part B 2.1" , desc= "Main theme(s) of the dataset" ,inbox='Topic category', example = "imageryBaseMapsEarthCover" , type ="MD_TopicCategory" , group= "Classification" ,  multi=0 , multiline= False #}</gmd:MD_TopicCategoryCode>
-      </gmd:topicCategory>
+            <gmd:topicCategory>
+                <gmd:MD_TopicCategoryCode>{{ tc }}{# tag="tc" , name="Topic" , ref= "Part B 2.1" , desc= "Main theme(s) of the dataset" ,inbox='Topic category', example = "imageryBaseMapsEarthCover" , type ="MD_TopicCategory" , group= "Classification" ,  multi=0 , multiline= False #}</gmd:MD_TopicCategoryCode>
+            </gmd:topicCategory>
       {% endfor -%}
-      <gmd:extent>
-        <gmd:EX_Extent>
-          <gmd:geographicElement>
-            <gmd:EX_GeographicBoundingBox>
-              <gmd:westBoundLongitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.minx }}{# tag="md.identification.extent.boundingBox.minx" , name="West Bound Longitude" , ref= "Part B 4.1" , desc= "Western-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "3.93" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:westBoundLongitude>
-              <gmd:eastBoundLongitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.maxx }}{# tag="md.identification.extent.boundingBox.maxx" , name="East Bound Longitude" , ref= "Part B 4.1" , desc= "Eastern-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "7.57" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:eastBoundLongitude>
-              <gmd:southBoundLatitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.miny }}{# tag="md.identification.extent.boundingBox.miny" , name="South Bound Latitude" , ref= "Part B 4.1" , desc= "Southern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "52.10" , type ="Decimal" , group= "Geographic" ,multi=0 , multiline= False #}</gco:Decimal>
-              </gmd:southBoundLatitude>
-              <gmd:northBoundLatitude>
-                <gco:Decimal>{{ md.identification.extent.boundingBox.maxy }}{# tag="md.identification.extent.boundingBox.maxy" , name="North Bound Latitude" , ref= "Part B 4.1" , desc= "Northern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "54.10" , type ="Decimal" , group= "Geographic" , multi=0 ,  multiline= False #}</gco:Decimal>
-              </gmd:northBoundLatitude>
-            </gmd:EX_GeographicBoundingBox>
-          </gmd:geographicElement>
-        </gmd:EX_Extent>
-      </gmd:extent>
+            <gmd:extent>
+                <gmd:EX_Extent>
+                    <gmd:geographicElement>
+                        <gmd:EX_GeographicBoundingBox>
+                            <gmd:westBoundLongitude>
+                                <gco:Decimal>{{ md.identification.extent.boundingBox.minx }}{# tag="md.identification.extent.boundingBox.minx" , name="West Bound Longitude" , ref= "Part B 4.1" , desc= "Western-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "3.93" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
+                            </gmd:westBoundLongitude>
+                            <gmd:eastBoundLongitude>
+                                <gco:Decimal>{{ md.identification.extent.boundingBox.maxx }}{# tag="md.identification.extent.boundingBox.maxx" , name="East Bound Longitude" , ref= "Part B 4.1" , desc= "Eastern-most coordinate of the limit of the dataset extent, expressed in longitude in decimal degrees (positive east)." , example = "7.57" , type ="Decimal" , group= "Geographic" ,  multi=0 ,  multiline= False #}</gco:Decimal>
+                            </gmd:eastBoundLongitude>
+                            <gmd:southBoundLatitude>
+                                <gco:Decimal>{{ md.identification.extent.boundingBox.miny }}{# tag="md.identification.extent.boundingBox.miny" , name="South Bound Latitude" , ref= "Part B 4.1" , desc= "Southern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "52.10" , type ="Decimal" , group= "Geographic" ,multi=0 , multiline= False #}</gco:Decimal>
+                            </gmd:southBoundLatitude>
+                            <gmd:northBoundLatitude>
+                                <gco:Decimal>{{ md.identification.extent.boundingBox.maxy }}{# tag="md.identification.extent.boundingBox.maxy" , name="North Bound Latitude" , ref= "Part B 4.1" , desc= "Northern-most coordinate of the limit of the dataset extent, expressed in latitude in decimal degrees (positive north)." , example = "54.10" , type ="Decimal" , group= "Geographic" , multi=0 ,  multiline= False #}</gco:Decimal>
+                            </gmd:northBoundLatitude>
+                        </gmd:EX_GeographicBoundingBox>
+                    </gmd:geographicElement>
+                </gmd:EX_Extent>
+            </gmd:extent>
       {% if md.identification.temporalextent_start != None -%}{# tag="if md.identification.temporalextent_start != None", group = "Temporal", inbox="Temporal Extent",inboxmulti= 0 #}
-      <gmd:extent>
-        <gmd:EX_Extent>
-          <gmd:temporalElement>
-            <gmd:EX_TemporalExtent>
-              <gmd:extent>
-                <gml:TimePeriod xsi:type="gml:TimePeriodType">
-                  <gml:beginPosition>{{ md.identification.temporalextent_start }}{# tag="md.identification.temporalextent_start" , name="Starting date" , ref= "Part B 5.1" , desc= "Time period covered by the content of the dataset." , example = "From 1977-03-10T11:45:30 to 2005-01-15T09:10:00" , type ="TM_Primitive" , group= "Temporal" , inbox= "Temporal extend", multi=0 , inboxmulti= 0, multiline= False #}</gml:beginPosition>
-                  <gml:endPosition>{{ md.identification.temporalextent_end }}{# tag="md.identification.temporalextent_end" , name="Ending date" , ref= "Part B 5.1" , desc= "Time period covered by the content of the dataset." , example = "From 1977-03-10T11:45:30 to 2005-01-15T09:10:00" , type ="TM_Primitive" , group= "Temporal" , inbox= "Temporal extend", multi=0 , inboxmulti= 0, multiline= False #}</gml:endPosition>
-                </gml:TimePeriod>
-              </gmd:extent>
-            </gmd:EX_TemporalExtent>
-          </gmd:temporalElement>
-        </gmd:EX_Extent>
-      </gmd:extent>
+            <gmd:extent>
+                <gmd:EX_Extent>
+                    <gmd:temporalElement>
+                        <gmd:EX_TemporalExtent>
+                            <gmd:extent>
+                                <gml:TimePeriod xsi:type="gml:TimePeriodType">
+                                    <gml:beginPosition>{{ md.identification.temporalextent_start }}{# tag="md.identification.temporalextent_start" , name="Starting date" , ref= "Part B 5.1" , desc= "Time period covered by the content of the dataset." , example = "From 1977-03-10T11:45:30 to 2005-01-15T09:10:00" , type ="TM_Primitive" , group= "Temporal" , inbox= "Temporal extend", multi=0 , inboxmulti= 0, multiline= False #}</gml:beginPosition>
+                                    <gml:endPosition>{{ md.identification.temporalextent_end }}{# tag="md.identification.temporalextent_end" , name="Ending date" , ref= "Part B 5.1" , desc= "Time period covered by the content of the dataset." , example = "From 1977-03-10T11:45:30 to 2005-01-15T09:10:00" , type ="TM_Primitive" , group= "Temporal" , inbox= "Temporal extend", multi=0 , inboxmulti= 0, multiline= False #}</gml:endPosition>
+                                </gml:TimePeriod>
+                            </gmd:extent>
+                        </gmd:EX_TemporalExtent>
+                    </gmd:temporalElement>
+                </gmd:EX_Extent>
+            </gmd:extent>
       {% endif -%}
-    </gmd:MD_DataIdentification>
-  </gmd:identificationInfo>
-  <gmd:distributionInfo>
-    <gmd:MD_Distribution>
-      <gmd:distributionFormat>
-        <gmd:MD_Format>
-          <gmd:name gco:nilReason="inapplicable"/>
-          <gmd:version gco:nilReason="inapplicable"/>
-        </gmd:MD_Format>
-      </gmd:distributionFormat>
-      <gmd:transferOptions>
-        <gmd:MD_DigitalTransferOptions>
+        </gmd:MD_DataIdentification>
+    </gmd:identificationInfo>
+    <gmd:distributionInfo>
+        <gmd:MD_Distribution>
+            <gmd:distributionFormat>
+                <gmd:MD_Format>
+                    <gmd:name gco:nilReason="inapplicable"/>
+                    <gmd:version gco:nilReason="inapplicable"/>
+                </gmd:MD_Format>
+            </gmd:distributionFormat>
+            <gmd:transferOptions>
+                <gmd:MD_DigitalTransferOptions>
           {% for ln in md.distribution.online -%}{# tag="for ln in md.distribution.online" , group= "Identification",object='CI_OnlineResource()'  #}
-          <gmd:onLine>
-            <gmd:CI_OnlineResource>
-              <gmd:linkage>
-                <gmd:URL>{{ ln.url }}{# tag="ln.url" , name="Linkage" , ref= "Part B 1.4" ,object='CI_OnlineResource()', desc= "Location (address) for on-line access using a Uniform Resource Locator address or similar addressing scheme." , example = "http://image2000.jrc.it" , type ="URL" , group= "Identification" ,multi=1, multiline= False #}</gmd:URL>
-              </gmd:linkage>
-            </gmd:CI_OnlineResource>
-          </gmd:onLine>
+                    <gmd:onLine>
+                        <gmd:CI_OnlineResource>
+                            <gmd:linkage>
+                                <gmd:URL>{{ ln.url }}{# tag="ln.url" , name="Linkage" , ref= "Part B 1.4" ,object='CI_OnlineResource()', desc= "Location (address) for on-line access using a Uniform Resource Locator address or similar addressing scheme." , example = "http://image2000.jrc.it" , type ="URL" , group= "Identification" ,multi=1, multiline= False #}</gmd:URL>
+                            </gmd:linkage>
+                        </gmd:CI_OnlineResource>
+                    </gmd:onLine>
           {% endfor -%}
-        </gmd:MD_DigitalTransferOptions>
-      </gmd:transferOptions>
-    </gmd:MD_Distribution>
-  </gmd:distributionInfo>
-  <gmd:dataQualityInfo>
-    <gmd:DQ_DataQuality>
-      <gmd:scope>
-        <gmd:DQ_Scope>
-          <gmd:level>
-            <gmd:MD_ScopeCode codeListValue="{{ md.identification.identtype }}"{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #} codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_ScopeCode"></gmd:MD_ScopeCode>
-          </gmd:level>
-        </gmd:DQ_Scope>
-      </gmd:scope>
-      <gmd:lineage>
-        <gmd:LI_Lineage>
-          <gmd:statement>
-            <gco:CharacterString>{{ md.dataquality.lineage }}{# tag="md.dataquality.lineage" , name="Lineage" , ref= "Part B 6.1" , desc= "General explanation of the data producer’s knowledge about the lineage of a dataset." , example = "Product 1 scenes correspond to the path/row of the Landsat orbit.." , type ="Text" , group= "Quality and Validity" ,  multiline= True #}</gco:CharacterString>
-          </gmd:statement>
-        </gmd:LI_Lineage>
-      </gmd:lineage>
-    </gmd:DQ_DataQuality>
-  </gmd:dataQualityInfo>
-      {% for (t,d,dt,dg) in zip(md.dataquality.conformancetitle,md.dataquality.conformancedate,md.dataquality.conformancedatetype,md.dataquality.conformancedegree) -%}{# tag="for (t,d,dt,dg) in zip(md.dataquality.conformancetitle,md.dataquality.conformancedate,md.dataquality.conformancedatetype,md.dataquality.conformancedegree)", group = "Conformity", inbox="Conformity",inboxmulti= 1 #}<gmd:report>
+                </gmd:MD_DigitalTransferOptions>
+            </gmd:transferOptions>
+        </gmd:MD_Distribution>
+    </gmd:distributionInfo>
+    <gmd:dataQualityInfo>
+        <gmd:DQ_DataQuality>
+            <gmd:scope>
+                <gmd:DQ_Scope>
+                    <gmd:level>
+                        <gmd:MD_ScopeCode codeListValue="{{ md.identification.identtype }}{# tag="md.identification.identtype", name ="Resource Type", desc ="Scope to which metadata applies", example ="dataset", type = "CharacterString", multi = 0, group = "Identification",multiline=True #}" codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#MD_ScopeCode"></gmd:MD_ScopeCode>
+                    </gmd:level>
+                </gmd:DQ_Scope>
+            </gmd:scope>
+            <gmd:lineage>
+                <gmd:LI_Lineage>
+                    <gmd:statement>
+                        <gco:CharacterString>{{ md.dataquality.lineage }}{# tag="md.dataquality.lineage" , name="Lineage" , ref= "Part B 6.1" , desc= "General explanation of the data producers knowledge about the lineage of a dataset." , example = "Product 1 scenes correspond to the path/row of the Landsat orbit.." , type ="Text" , group= "Quality and Validity" ,  multiline= True #}</gco:CharacterString>
+                    </gmd:statement>
+                </gmd:LI_Lineage>
+            </gmd:lineage>
+        </gmd:DQ_DataQuality>
+    </gmd:dataQualityInfo>
+      {% for (t,d,dt,dg) in zip(md.dataquality.conformancetitle,md.dataquality.conformancedate,md.dataquality.conformancedatetype,md.dataquality.conformancedegree) -%}{# tag="for (t,d,dt,dg) in zip(md.dataquality.conformancetitle,md.dataquality.conformancedate,md.dataquality.conformancedatetype,md.dataquality.conformancedegree)", group = "Conformity", inbox="Conformity",inboxmulti= 1 #}
+    <gmd:report>
         <gmd:DQ_DomainConsistency xsi:type="gmd:DQ_DomainConsistency_Type">
-          <gmd:measureIdentification>
-            <gmd:RS_Identifier>
-              <gmd:code>
-                <gco:CharacterString>Conformity</gco:CharacterString>
-              </gmd:code>
-              <gmd:codeSpace>
-                <gco:CharacterString>INSPIRE</gco:CharacterString>
-              </gmd:codeSpace>
-            </gmd:RS_Identifier>
-          </gmd:measureIdentification>
-          <gmd:result>
-            <gmd:DQ_ConformanceResult xsi:type="gmd:DQ_ConformanceResult_Type">
-              <gmd:specification>
-                <gmd:CI_Citation>
-                  <gmd:title>
-                    <gco:CharacterString>{{ t }}{# tag="t" , name="Specification" , ref= "Part B 7.1" , desc= "citation of the product specification or user requirement against which data is being evaluated." , example = "INSPIRE Data Specification on orthoimagery - Guidelines" , type ="CI_Citation" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= True #}</gco:CharacterString>
-                  </gmd:title>
-                  <gmd:date>
-                    <gmd:CI_Date>
-                      <gmd:date>
-                        <gco:Date>{{ d }}{# tag="d" , name="Date" , ref= "Part B 7.1" , desc= "citation of the product specification or user requirement against which data is being evaluated." , example = "2010-04-26" , type ="Date" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}</gco:Date>
-                      </gmd:date>
-                      <gmd:dateType>
-                        <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ dt }}"{# tag="dt" , name="Date type" , ref= "Part B 7.1" , desc= "a date type: creation, revision or publication." , example = "publication" , type ="dateType" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}></gmd:CI_DateTypeCode>
-                      </gmd:dateType>
-                    </gmd:CI_Date>
-                  </gmd:date>
-                </gmd:CI_Citation>
-              </gmd:specification>
-              <gmd:explanation>
-                <gco:CharacterString>See the referenced specification</gco:CharacterString>
-              </gmd:explanation>
-              <gmd:pass>
-                <gco:Boolean>{{ dg }}{# tag="dg" , name="Degree" , ref= "Part B 7.1" , desc= "Is it valid?" , example = "This is the degree of conformity of the resource to the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification." , type ="Boolean" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}</gco:Boolean>
-              </gmd:pass>
-            </gmd:DQ_ConformanceResult>
-          </gmd:result>
+            <gmd:measureIdentification>
+                <gmd:RS_Identifier>
+                    <gmd:code>
+                        <gco:CharacterString>Conformity</gco:CharacterString>
+                    </gmd:code>
+                    <gmd:codeSpace>
+                        <gco:CharacterString>INSPIRE</gco:CharacterString>
+                    </gmd:codeSpace>
+                </gmd:RS_Identifier>
+            </gmd:measureIdentification>
+            <gmd:result>
+                <gmd:DQ_ConformanceResult xsi:type="gmd:DQ_ConformanceResult_Type">
+                    <gmd:specification>
+                        <gmd:CI_Citation>
+                            <gmd:title>
+                                <gco:CharacterString>{{ t }}{# tag="t" , name="Specification" , ref= "Part B 7.1" , desc= "citation of the product specification or user requirement against which data is being evaluated." , example = "INSPIRE Data Specification on orthoimagery - Guidelines" , type ="CI_Citation" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= True #}</gco:CharacterString>
+                            </gmd:title>
+                            <gmd:date>
+                                <gmd:CI_Date>
+                                    <gmd:date>
+                                        <gco:Date>{{ d }}{# tag="d" , name="Date" , ref= "Part B 7.1" , desc= "citation of the product specification or user requirement against which data is being evaluated." , example = "2010-04-26" , type ="Date" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}</gco:Date>
+                                    </gmd:date>
+                                    <gmd:dateType>
+                                        <gmd:CI_DateTypeCode codeList="http://www.isotc211.org/2005/resources/Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="{{ dt }}{# tag="dt" , name="Date type" , ref= "Part B 7.1" , desc= "a date type: creation, revision or publication." , example = "publication" , type ="dateType" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}"></gmd:CI_DateTypeCode>
+                                    </gmd:dateType>
+                                </gmd:CI_Date>
+                            </gmd:date>
+                        </gmd:CI_Citation>
+                    </gmd:specification>
+                    <gmd:explanation>
+                        <gco:CharacterString>See the referenced specification</gco:CharacterString>
+                    </gmd:explanation>
+                    <gmd:pass>
+                        <gco:Boolean>{{ dg }}{# tag="dg" , name="Degree" , ref= "Part B 7.1" , desc= "Is it valid?" , example = "This is the degree of conformity of the resource to the implementing rules adopted under Article 7(1) of Directive 2007/2/EC or other specification." , type ="Boolean" , group= "Conformity" , inbox= "Conformity", multi=0 , inboxmulti= 1, multiline= False #}</gco:Boolean>
+                    </gmd:pass>
+                </gmd:DQ_ConformanceResult>
+            </gmd:result>
         </gmd:DQ_DomainConsistency>
-      </gmd:report>
+    </gmd:report>
       {% endfor -%}
 </gmd:MD_Metadata>



More information about the grass-commit mailing list