<?xml version="1.0"?>

<sx:resources xmlns:sx="http://www.servingxml.com/core">

  <sx:service id="messages">
    <sx:serialize>
      <sx:transform>
        <sx:content ref="messages"/>
      </sx:transform>
    </sx:serialize>
  </sx:service>

  <sx:recordContent id="messages">

    <sx:flatFileReader countPositionsInBytes="false">
      <sx:flatFile>
        <sx:commentStarter value="#"/>
        <sx:commentStarter value="//"/>
        <sx:recordDelimiter continuation="\" value="\r\n"/>
        <sx:recordDelimiter continuation="\" value="\n"/>
        <sx:flatFileBody>
          <sx:flatRecordType name="property">
            <sx:delimitedField name="key1">
              <sx:fieldDelimiter value="."/>
            </sx:delimitedField>
            <sx:delimitedField name="key2">
              <sx:fieldDelimiter value="."/>
            </sx:delimitedField>
            <sx:delimitedField name="key3">
              <sx:fieldDelimiter value="="/>
            </sx:delimitedField>
            <sx:delimitedField name="value"/>
          </sx:flatRecordType>
        </sx:flatFileBody>
      </sx:flatFile>
    </sx:flatFileReader>

    <sx:recordMapping>
      <messages>
        <sx:groupBy fields="key1">
          <sx:elementMap element="{key1}">
            <sx:groupBy fields="key2 key2">
              <sx:elementMap element="{key2}">
                <sx:onRecord>
                  <sx:fieldElementMap field="value" element="{key3}"/>
                </sx:onRecord>
              </sx:elementMap>
            </sx:groupBy>
          </sx:elementMap>
        </sx:groupBy>
      </messages>
    </sx:recordMapping>

  </sx:recordContent>

</sx:resources>

