plik xml:
<bazafilmow> <film id="9"> <tytul>Czarny Łabędź</tytul> <gatunki> <gatunek>Dramat</gatunek> <gatunek>Psychologiczny</gatunek> </gatunki> <obsada> <aktor> <imie>Natalie</imie> <nazwisko>Portman</nazwisko> <rola>Nina Sayers</rola> </aktor> <aktor> <imie>Mila</imie> <nazwisko>Kunis</nazwisko> <rola>Lily</rola> </aktor> <aktor> <imie>Vincent</imie> <nazwisko>Cassel</nazwisko> <rola>Thomas Leroy</rola> </aktor> </obsada> <rezyser> <imie>Darren</imie> <nazwisko>Aronofsky</nazwisko> </rezyser> <czas>108</czas> <jakiKraj>USA</jakiKraj> <dataProdukcji>2010-09-01</dataProdukcji> <cena>10 zł</cena> <opis>Nina (Natalie Portman) jest baleriną w jednym z najlepszych zepołów baletowych w Nowym Jorku. Panuje tam zimne wyrachowanie. Baletnice zrobią wszystko, by zepchnąć w dół dziewczynę, która tylko stanie o stopień wyżej niż one. Zbliża się kres kariery Beth i rozpoczyna się polowanie na jej miejsce w "Jeziorze Łabędzim". Główną rolą jest postać Odett, królowej łabędzi. Rola ta jest trudna, bo balerina będzie musiała grać zarówno słodkiego "Białego Łabędzia", jak i mrocznego "Czarnego Łabędzia". ... Oczywiście Nina pretenduje do roli tego pierwszego, ale czy będzie umiała pokazać pazurki i zostać "Czarnym Łabędziem"? Czas płynie, a Nina desperacko próbuje odnaleźć swoją ciemną stronę.</opis> <dataDodania>2011-10-01</dataDodania> <egzemplarze> <egzemplarz id="116" nosnik="dvd" wypozyczono="true" stan="OK"></egzemplarz> <egzemplarz id="117" nosnik="dvd" wypozyczono="false" stan="OK"></egzemplarz> </egzemplarze> </film> <bazaFilmow>
plik xsl:
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="html"/> <xsl:document href="index.html" method="html"/> <xsl:param name="x"/> <xsl:template match="/"> <html> <head> <style type="text/css"> img { width: 160px; height: 230px; } </style> <title> </title> </head> <body> <xsl:apply-templates select="bazaFilmow" > <xsl:apply-templates select="film/gatunki[gatunek='Dramat']"/> </xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="film"> <table style="text-align:left; border: 2px solid black;"> <tr> <td colspan="3" style="font-size:20px; border:1px; color:red"><xsl:value-of select="tytul" /></td><td></td> </tr> <tr> <td width="160px" rowspan="7"> <xsl:call-template name="obrazek"> <xsl:with-param name="source" select="@id"/> <xsl:with-param name="alttext" select="'obrazek'"/> </xsl:call-template> </td> <td width="300px"> Gatunek: <xsl:call-template name="gat" /> </td> <td rowspan="4"> Obsada: <xsl:call-template name="akt" /> </td> </tr> <tr> <td width="300px"> reżyser: <xsl:value-of select="rezyser"/> </td> </tr> <tr> <td width="300px"> czas: <xsl:value-of select="czas"/> min </td> </tr> <tr> <td width="300px"> data: <xsl:value-of select="dataProdukcji"/> </td> </tr> <tr> <td width="300px"> produkcja: <xsl:value-of select="jakiKraj"/> </td> <td rowspan="3" width="300px"> egzemplarze: <xsl:call-template name="egz" /> </td> </tr> <tr> <td width="300px"> data dodania: <xsl:value-of select="dataDodania"/> </td> </tr> <tr> <td width="300px"> cena: <xsl:value-of select="cena"/> </td> </tr> <tr> <td colspan="3"> <xsl:value-of select="opis"/> </td> </tr> </table> </xsl:template> <xsl:template name="gat"> <xsl:for-each select="gatunki/gatunek"> <xsl:value-of select="current()" />, </xsl:for-each> </xsl:template> <xsl:template name="akt"> <ul> <xsl:for-each select="obsada/aktor"> <li> <xsl:value-of select="rola"/>: <xsl:value-of select="imie"/><xsl:text> </xsl:text><xsl:value-of select="nazwisko"/> </li> </xsl:for-each> </ul> </xsl:template> <xsl:template name="egz"> <xsl:for-each select="egzemplarze/egzemplarz"> <li> numer: <xsl:value-of select="current()/@id" />, nośnik: <xsl:value-of select="current()/@nosnik" />, <xsl:choose> <xsl:when test="current()/@wypozyczono = 'false'"> dostępny </xsl:when> <xsl:otherwise> wypożyczony </xsl:otherwise> </xsl:choose> </li> </xsl:for-each> </xsl:template> <xsl:template name="obrazek"> <xsl:param name="source" /> <xsl:param name="alttext" /> <img src="images/{$source}.jpg" style="padding: 5px; border:1px" alt="{$alttext}"/> </xsl:template> </xsl:stylesheet>
Problem rozwiazany, mozna zamknac temat
