<?xml version="1.0" encoding="UTF-8"?>
<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:template match="konference">
  <html>
    <head>
      <title>Program <xsl:value-of select="název"/></title>
      <style>
        body { font-family: Calibri, sans-serif; }
        h1 { text-align: center; background-color: navy; color: yellow; }
        h2,h3 { color: navy; }
      </style>
    </head>
    <body>
      <h1><xsl:value-of select="název"/></h1>
      
      <xsl:for-each-group select="přednáška" group-by="@datum">
        <xsl:sort select="xs:date(current-grouping-key())"/>
        
        <h2><xsl:value-of select="format-date(current-grouping-key(), '[D]. [M]. [Y]')"/></h2>
        
        <xsl:for-each-group select="current-group()" group-by="@začátek">
          <xsl:sort select="xs:time(@začátek)"/>
          
          <h3><xsl:value-of select="current-grouping-key()"/></h3>
          
          <xsl:for-each select="current-group()">
            <xsl:sort select="sekce" lang="cs"/>
            
            <p>
              <xsl:value-of select="název"/>
              (<xsl:value-of select="sekce"/>)
              - <i><xsl:value-of select="autor/jméno"/></i>
            </p>
          </xsl:for-each>
          <hr/>
          
        </xsl:for-each-group>
        
      </xsl:for-each-group>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>