<?xml version="1.0"?>
    <TileMapService version="1.0.0">
    <Title>{{service.title}}</Title>
    <Abstract>{{service.abstract}}</Abstract>
{{if service.keyword_list and len(service.keyword_list) > 0}}
    <KeywordList>{{for list in service.keyword_list}}{{py: kw=bunch(default='', **list)}}{{" ".join(map(lambda k : '"'+k+'"', kw.keywords))}}{{endfor}}</KeywordList>
{{endif}}
{{if service.contact}}
{{py:service.contact = bunch(default='', **service.contact)}}
    <ContactInformation>
        <ContactPersonPrimary>
            <ContactPerson>{{service.contact.person}}</ContactPerson>
            <ContactOrganization>{{service.contact.organization}}</ContactOrganization>
        </ContactPersonPrimary>
        <ContactPosition>{{service.contact.position}}</ContactPosition>
        <ContactAddress>
            <Address>{{service.contact.address}}</Address>
            <City>{{service.contact.city}}</City>
            <PostCode>{{service.contact.postcode}}</PostCode>
            <Country>{{service.contact.country}}</Country>
        </ContactAddress>
        <ContactVoiceTelephone>{{service.contact.phone}}</ContactVoiceTelephone>
        <ContactFacsimileTelephone>{{service.contact.fax}}</ContactFacsimileTelephone>
        <ContactElectronicMailAddress>{{service.contact.email}}</ContactElectronicMailAddress>
    </ContactInformation>
{{endif}}    
    <TileMaps>
{{for layer in layers.values()}}
        <TileMap title="{{layer.title}}"
                 srs="{{layer.grid.srs_name}}"
                 profile="{{layer.grid.profile}}"
                 href="{{service.url.rstrip('/')}}/{{'/'.join(layer.md['name_path'])}}" />
{{endfor}}
    </TileMaps>
</TileMapService>
