Řazení – xsl:sort

  • před zpracováním lze uzly seřadit

  • xsl:for-each, xsl:for-each-group, xsl:apply-templates

Příklad 6. Seřazení hodnot – razeni.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  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 { color: navy; }
      </style>
    </head>
    <body>
      <h1><xsl:value-of select="název"/></h1>
      
      <xsl:for-each select="přednáška">
        <xsl:sort select="název" lang="cs"/>
        
        <h2><xsl:value-of select="název"/></h2>      
        <p><i><xsl:value-of select="autor/jméno"/>
              <xsl:if test="autor/organizace">
                (<xsl:value-of select="autor/organizace"/>)
              </xsl:if>
           </i></p>
        <p><xsl:value-of select="popis"/></p>
        <xsl:if test="position() lt last()">
          <hr/>
        </xsl:if>
      </xsl:for-each>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>