The FSFE planet, a blog aggregator of posts from our community https://planet.fsfe.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

atom.xml.xslt 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  2. xmlns:access="http://www.bloglines.com/about/specs/fac-1.0"
  3. xmlns:atom="http://www.w3.org/2005/Atom"
  4. xmlns:indexing="urn:atom-extension:indexing"
  5. xmlns:planet="http://planet.intertwingly.net/"
  6. xmlns:xhtml="http://www.w3.org/1999/xhtml"
  7. xmlns="http://www.w3.org/1999/xhtml"
  8. exclude-result-prefixes="planet xhtml">
  9. <!-- strip planet elements and attributes -->
  10. <xsl:template match="planet:*|@planet:*"/>
  11. <!-- strip obsolete link relationships -->
  12. <xsl:template match="atom:link[@rel='service.edit']"/>
  13. <xsl:template match="atom:link[@rel='service.post']"/>
  14. <xsl:template match="atom:link[@rel='service.feed']"/>
  15. <!-- Feedburner detritus -->
  16. <xsl:template match="xhtml:div[@class='feedflare']"/>
  17. <!-- Strip site meter -->
  18. <xsl:template match="xhtml:div[comment()[. = ' Site Meter ']]"/>
  19. <!-- add Google/LiveJournal-esque and Bloglines noindex directive -->
  20. <xsl:template match="atom:feed">
  21. <xsl:copy>
  22. <xsl:attribute name="indexing:index">no</xsl:attribute>
  23. <xsl:apply-templates select="@*"/>
  24. <access:restriction relationship="deny"/>
  25. <xsl:apply-templates select="node()"/>
  26. <xsl:text>&#10;</xsl:text>
  27. </xsl:copy>
  28. </xsl:template>
  29. <!-- popular customization: add planet name to each entry title
  30. <xsl:template match="atom:entry/atom:title">
  31. <xsl:text>&#10; </xsl:text>
  32. <xsl:copy>
  33. <xsl:apply-templates select="@*"/>
  34. <xsl:value-of select="../atom:source/planet:name"/>
  35. <xsl:text>: </xsl:text>
  36. <xsl:apply-templates select="node()"/>
  37. </xsl:copy>
  38. </xsl:template>
  39. -->
  40. <!-- indent atom elements -->
  41. <xsl:template match="atom:*">
  42. <!-- double space before atom:entries -->
  43. <xsl:if test="self::atom:entry">
  44. <xsl:text>&#10;</xsl:text>
  45. </xsl:if>
  46. <!-- indent start tag -->
  47. <xsl:text>&#10;</xsl:text>
  48. <xsl:for-each select="ancestor::*">
  49. <xsl:text> </xsl:text>
  50. </xsl:for-each>
  51. <xsl:copy>
  52. <xsl:apply-templates select="@*|node()"/>
  53. <!-- indent end tag if there are element children -->
  54. <xsl:if test="*">
  55. <xsl:text>&#10;</xsl:text>
  56. <xsl:for-each select="ancestor::*">
  57. <xsl:text> </xsl:text>
  58. </xsl:for-each>
  59. </xsl:if>
  60. </xsl:copy>
  61. </xsl:template>
  62. <!-- pass through everything else -->
  63. <xsl:template match="@*|node()">
  64. <xsl:copy>
  65. <xsl:apply-templates select="@*|node()"/>
  66. </xsl:copy>
  67. </xsl:template>
  68. </xsl:stylesheet>