<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="xs" version="2.0">

<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/">
  <xsl:variable name="data" select="unparsed-text('data.txt')"/>

  <xsl:variable name="dated" as="node()*">
    <xsl:analyze-string select="$data" regex="\d+-\d+-\d+">
      <xsl:matching-substring>
	<date>
	  <xsl:value-of select='format-date(xs:date(.),                 "[MNn,*-3] [D01], [Y0001]")'/>
	</date>
      </xsl:matching-substring>
      <xsl:non-matching-substring>
	<xsl:analyze-string select="." regex="===">
	  <xsl:matching-substring>
	    <eog/>
	  </xsl:matching-substring>
	  <xsl:non-matching-substring>
	    <xsl:value-of select="."/>
	  </xsl:non-matching-substring>
	</xsl:analyze-string>
      </xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:variable>

  <xsl:variable name="days">
    <xsl:for-each-group select="$dated" group-starting-with="date">
      <day>
	<xsl:copy-of select="current-group()"/>
      </day>
    </xsl:for-each-group>
  </xsl:variable>

  <days>
    <xsl:for-each select="$days/day">
      <day>
	<xsl:copy-of select="date"/>
	<xsl:for-each-group select="date/following-sibling::node()" group-ending-with="eog">
	  <group>
	    <xsl:copy-of select="."/>
	  </group>
	</xsl:for-each-group>
      </day>
    </xsl:for-each>
  </days>

</xsl:template>

</xsl:stylesheet>