|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<xsl:stylesheet version="1.0" |
| 3 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 4 | + xmlns:atom="http://www.w3.org/2005/Atom" |
| 5 | + xmlns:dc="http://purl.org/dc/elements/1.1/"> |
| 6 | + |
| 7 | + <xsl:output method="html" encoding="UTF-8" indent="yes"/> |
| 8 | + |
| 9 | + <xsl:template match="/"> |
| 10 | + <html> |
| 11 | + <head> |
| 12 | + <meta charset="UTF-8"/> |
| 13 | + <title> |
| 14 | + <xsl:value-of select="rss/channel/title"/> |
| 15 | + </title> |
| 16 | + <style> |
| 17 | +body { |
| 18 | + font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; |
| 19 | + max-width: 900px; |
| 20 | + margin: 40px auto; |
| 21 | + padding: 0 20px; |
| 22 | + background: #f9fafb; |
| 23 | + color: #111827; |
| 24 | +} |
| 25 | + |
| 26 | +header { |
| 27 | + border-bottom: 2px solid #e5e7eb; |
| 28 | + padding-bottom: 20px; |
| 29 | + margin-bottom: 30px; |
| 30 | +} |
| 31 | + |
| 32 | +header img { |
| 33 | + vertical-align: middle; |
| 34 | + margin-right: 15px; |
| 35 | +} |
| 36 | +header .meta { |
| 37 | + margin-top: 15px; |
| 38 | + font-size: 0.9em; |
| 39 | + color: #6b7280; |
| 40 | +} |
| 41 | + |
| 42 | +h1 { |
| 43 | + margin: 0; |
| 44 | +} |
| 45 | + |
| 46 | +.item { |
| 47 | + background: white; |
| 48 | + padding: 20px; |
| 49 | + margin-bottom: 25px; |
| 50 | + border-radius: 10px; |
| 51 | + box-shadow: 0 4px 12px rgba(0,0,0,0.05); |
| 52 | +} |
| 53 | + |
| 54 | +.item h2 { |
| 55 | + margin-top: 0; |
| 56 | +} |
| 57 | + |
| 58 | +.meta { |
| 59 | + font-size: 0.9em; |
| 60 | + color: #6b7280; |
| 61 | + margin-bottom: 10px; |
| 62 | +} |
| 63 | + |
| 64 | +.categories span { |
| 65 | + background: #eef2ff; |
| 66 | + color: #3730a3; |
| 67 | + padding: 3px 8px; |
| 68 | + margin-right: 5px; |
| 69 | + border-radius: 6px; |
| 70 | + font-size: 0.75em; |
| 71 | +} |
| 72 | + |
| 73 | +.item img { |
| 74 | + max-width: 100%; |
| 75 | + margin: 15px 0; |
| 76 | + border-radius: 8px; |
| 77 | +} |
| 78 | + |
| 79 | +a { |
| 80 | + color: #2563eb; |
| 81 | + text-decoration: none; |
| 82 | +} |
| 83 | + |
| 84 | +a:hover { |
| 85 | + text-decoration: underline; |
| 86 | +} |
| 87 | + </style> |
| 88 | + </head> |
| 89 | + |
| 90 | + <body> |
| 91 | + |
| 92 | + <header> |
| 93 | + <xsl:if test="rss/channel/image/url"> |
| 94 | + <img> |
| 95 | + <xsl:attribute name="src"> |
| 96 | + <xsl:value-of select="rss/channel/image/url"/> |
| 97 | + </xsl:attribute> |
| 98 | + <xsl:attribute name="width">64</xsl:attribute> |
| 99 | + </img> |
| 100 | + </xsl:if> |
| 101 | + |
| 102 | + <h1> |
| 103 | + <xsl:value-of select="rss/channel/title"/> |
| 104 | + </h1> |
| 105 | + |
| 106 | + <p> |
| 107 | + <xsl:value-of select="rss/channel/description"/> |
| 108 | + </p> |
| 109 | + |
| 110 | + <p> |
| 111 | + <a> |
| 112 | + <xsl:attribute name="href"> |
| 113 | + <xsl:value-of select="rss/channel/link"/> |
| 114 | + </xsl:attribute> |
| 115 | + Visit website |
| 116 | + </a> |
| 117 | + </p> |
| 118 | + <div class="meta"> |
| 119 | + |
| 120 | + <xsl:if test="author"> |
| 121 | + By <xsl:value-of select="author"/> |
| 122 | + </xsl:if> |
| 123 | + |
| 124 | + <xsl:if test="pubDate"> |
| 125 | + — <strong>Published:</strong> |
| 126 | + <xsl:value-of select="pubDate"/> |
| 127 | + </xsl:if> |
| 128 | + |
| 129 | + <xsl:if test="updated"> |
| 130 | + — <strong>Updated:</strong> |
| 131 | + <xsl:value-of select="updated"/> |
| 132 | + </xsl:if> |
| 133 | + |
| 134 | + </div> |
| 135 | + </header> |
| 136 | + |
| 137 | + <xsl:for-each select="rss/channel/item"> |
| 138 | + |
| 139 | + <div class="item"> |
| 140 | + |
| 141 | + <h2> |
| 142 | + <a> |
| 143 | + <xsl:attribute name="href"> |
| 144 | + <xsl:value-of select="link"/> |
| 145 | + </xsl:attribute> |
| 146 | + <xsl:value-of select="title"/> |
| 147 | + </a> |
| 148 | + </h2> |
| 149 | + |
| 150 | + <div class="meta"> |
| 151 | + <xsl:if test="author"> |
| 152 | + Par <xsl:value-of select="author"/> |
| 153 | + </xsl:if> |
| 154 | + <xsl:if test="pubDate"> |
| 155 | + — <xsl:value-of select="pubDate"/> |
| 156 | + </xsl:if> |
| 157 | + </div> |
| 158 | + |
| 159 | + <!-- Image si enclosure image/* --> |
| 160 | + <xsl:if test="enclosure[starts-with(@type,'image/')]"> |
| 161 | + <img> |
| 162 | + <xsl:attribute name="src"> |
| 163 | + <xsl:value-of select="enclosure/@url"/> |
| 164 | + </xsl:attribute> |
| 165 | + </img> |
| 166 | + </xsl:if> |
| 167 | + |
| 168 | + <p> |
| 169 | + <xsl:value-of select="description"/> |
| 170 | + </p> |
| 171 | + |
| 172 | + <div class="categories"> |
| 173 | + <xsl:for-each select="category"> |
| 174 | + <span> |
| 175 | + <xsl:value-of select="."/> |
| 176 | + </span> |
| 177 | + </xsl:for-each> |
| 178 | + </div> |
| 179 | + |
| 180 | + </div> |
| 181 | + |
| 182 | + </xsl:for-each> |
| 183 | + |
| 184 | + </body> |
| 185 | + </html> |
| 186 | + </xsl:template> |
| 187 | + |
| 188 | +</xsl:stylesheet> |
0 commit comments