datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
namespace pmd = "http://www.politicalmashup.nl/docinfo"

include "toolbox.rnc"

# Docinfo is the first child of root. Its purpose is to describe all transformation steps that were performed to create the document.
# Each transformation step is described in a pmd:transformer element.
# Provide in its attributes all information necessary to redo the exact same transformation.
# If the transformation step adds data to the document, then this must be declared in a root/meta/dc:source element as well.
# This is done with a reference from pm:transformer-ref to pmd:transformer-id. Use a unique string (all pmd:transformer-id's within pmd:docinfo must be unique). 
# Use the pmd:comment element to add additional information if necessary to understand the transformation step(s).

start = DocInfo

DocInfo =
    element pmd:docinfo {
      Id? # Data should contain [identifier].docinfo
      & DocInfoContent
    
    }

DocInfoContent = (Transformer | Validation | Comment ) +

Transformer =
    element pmd:transformer {TransformerContent
        
     }

TransformerContent = attribute pmd:name {text}
        & attribute pmd:version {text}?
        & attribute pmd:datetime {xsd:dateTime}?
        & attribute pmd:arguments {text}?
        & attribute pmd:result { ResultType }?
        & attribute pmd:transformer-id{text}?  # An optional string in case this transformation step adds data. Refer to it in DcSource, with a pm:transformer-ref{text}
        & PmdComment*

Validation = element pmd:validation { ValidationContent }

ValidationContent = attribute pmd:type { 'rnc' | 'sch' }
                  & attribute pmd:datetime { xsd:dateTime }
                  & attribute pmd:schema { xsd:anyURI }
                  & attribute pmd:version { text }
                  & element pmd:warning { text }*

PmdComment = element pmd:comment {anything}