Advertisement
bansuuuj

filmoteka5.xls

Nov 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  4.  
  5. <xsl:template match="/">
  6. <html>
  7. <body>
  8. <h2>Filmoteka</h2>
  9. <table border="1">
  10. <tr bgcolor="#0000ff" style="color:#ffffff">
  11. <th>Tytuł polski</th>
  12. <th>Tytuł oryginalny</th>
  13. <th>Reżyseria</th>
  14. <th>Produkcja</th>
  15. <th>Rok produkcji</th>
  16. <th>Czas trwania</th>
  17. <th>Gatunek</th>
  18. <th>Obsada</th>
  19. </tr>
  20. <xsl:apply-templates select="filmoteka/film[kraj = 'Polska']"/>
  21. <xsl:call-template name="separator"/>
  22. <xsl:apply-templates select="filmoteka/film[kraj != 'Polska']"/>
  23. </table>
  24. </body>
  25. </html>
  26. </xsl:template>
  27.  
  28. <xsl:template name="separator">
  29. <tr>
  30. <th>
  31. <hr/>
  32. </th>
  33. <th>
  34. <hr/>
  35. </th>
  36. <th>
  37. <hr/>
  38. </th>
  39. <th>
  40. <hr/>
  41. </th>
  42. <th>
  43. <hr/>
  44. </th>
  45. <th>
  46. <hr/>
  47. </th>
  48. <th>
  49. <hr/>
  50. </th>
  51. <th>
  52. <hr/>
  53. </th>
  54. </tr>
  55. </xsl:template>
  56.  
  57. <xsl:template match="film">
  58. <tr>
  59. <th>
  60. <xsl:value-of select="tytul_pol"/>
  61. </th>
  62. <th>
  63. <xsl:value-of select="tytul_oryg"/>
  64. </th>
  65. <th>
  66. <xsl:value-of select="rezyser"/>
  67. </th>
  68. <th>
  69. <xsl:value-of select="kraj"/>
  70. </th>
  71. <th>
  72. <xsl:value-of select="rok"/>
  73. </th>
  74.  
  75. <xsl:choose>
  76. <xsl:when test="czas_trwania &lt; 120">
  77. <th style="color: #00cc00;">
  78. <xsl:value-of select="czas_trwania"/>
  79. </th>
  80. </xsl:when>
  81. <xsl:when test="czas_trwania &gt; 150">
  82. <th style="color: #cc0000;">
  83. <xsl:value-of select="czas_trwania"/>
  84. </th>
  85. </xsl:when>
  86. <xsl:otherwise>
  87. <th style="color: #e6b800;">
  88. <xsl:value-of select="czas_trwania"/>
  89. </th>
  90. </xsl:otherwise>
  91. </xsl:choose>
  92.  
  93. <th>
  94. <xsl:value-of select="gatunek"/>
  95. </th>
  96. <th>
  97. <xsl:value-of select="obsada"/>
  98. </th>
  99. </tr>
  100. </xsl:template>
  101.  
  102.  
  103. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement