<?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="autor/jméno">
        <xsl:sort select="count(current-group())" order="descending"/>
        
        <h2><xsl:value-of select="current-grouping-key()"/></h2>
        
        <ol>
          <xsl:for-each select="current-group()">
            <xsl:sort select="xs:date(@datum)"/>
            <xsl:sort select="xs:time(@zacatek)"/>
            
            <li>
              <xsl:value-of select="název"/>
              (<xsl:value-of select="format-date(xs:date(@datum), '[F]')"/>, 
              <xsl:value-of select="format-time(xs:time(@začátek), '[H]:[m01]')"/>–<xsl:value-of select="format-time(xs:time(@konec), '[H]:[m01]')"/>)
            </li>
          </xsl:for-each>
        </ol>
        
      </xsl:for-each-group>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>