rss.xsl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" version="5" encoding="UTF-8" indent="yes" />
  4. <xsl:template match="rss">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <title><xsl:value-of select="channel/title" /> RSS Feed</title>
  8. <meta charset="UTF-8" />
  9. <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" />
  10. <meta name="viewport" content="width=device-width,initial-scale=1" />
  11. <style type="text/css">
  12. html {
  13. background: #fff;
  14. color: #444;
  15. }
  16. a {
  17. color: #334999;
  18. text-decoration: none;
  19. }
  20. a:hover {
  21. text-decoration: underline;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <header>
  27. <h2>
  28. <xsl:value-of select="channel/description" />
  29. </h2>
  30. </header>
  31. <hr />
  32. <main>
  33. <xsl:for-each select="channel/item">
  34. <article>
  35. <h3>
  36. <a hreflang="en" target="_blank">
  37. <xsl:attribute name="href">
  38. <xsl:value-of select="link" />
  39. </xsl:attribute>
  40. <xsl:value-of select="title" />
  41. </a>
  42. </h3>
  43. <time>
  44. <xsl:value-of select="pubDate" />
  45. </time>
  46. <p><xsl:value-of select="description" /></p>
  47. <hr />
  48. </article>
  49. </xsl:for-each>
  50. </main>
  51. </body>
  52. </html>
  53. </xsl:template>
  54. </xsl:stylesheet>