Příklad 4. katalog-otoceny.xsl
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="html" encoding="utf-8"/> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="/katalog/nazev"/></title> <style type="text/css"> body { color: black; background-color: white; } table { border: solid 2px black; border-collapse: collapse; } th a { text-decoration: none; color: black; } th { background-color: #FF8000; } th, td { border: solid 1px black; } </style> </head> <body> <h1> <xsl:value-of select="/katalog/nazev"/> </h1> <table width="100%"> <tr> <th>Název</th> <!-- Vybereme všechny položky a vypíšeme jejich názvy --> <xsl:for-each select="/katalog/polozka"> <td align="center"><xsl:value-of select="nazev"/></td> </xsl:for-each> </tr> <tr> <th>Kategorie</th> <!-- Vybereme všechny položky a vypíšeme jejich kategorie --> <xsl:for-each select="/katalog/polozka"> <td align="center"><xsl:value-of select="kategorie"/></td> </xsl:for-each> </tr> <tr> <th>Cena</th> <!-- Vybereme všechny položky a vypíšeme jejich ceny --> <xsl:for-each select="/katalog/polozka"> <td align="center"><xsl:value-of select="cena"/></td> </xsl:for-each> </tr> </table> </body> </html> </xsl:template> </xsl:stylesheet>