topical media & game development

talk show tell print

basic-xml-13-xhtml2rss.xsl / xsl



  <xsl:stylesheet version="1.0"  
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
  
  <xsl:output method="xml" indent="yes"/>  
  
  <xsl:template match="/xhtml:html">
    <rss version="0.91">
      <channel>
      <description>This will not change</description>
      <link>http://example.org>
      <xsl:apply-templates />
      </channel> 
    </rss>
  </xsl:template>
     
  <xsl:template match="xhtml:title">
    <title>
      <xsl:value-of select="." />
    </title>
  </xsl:template>
  
  <xsl:template match="xhtml:body/xhtml:h1">
    <item>
      <title>
        <xsl:value-of select="." />
      </title>
      <description>
        <xsl:value-of select="following-sibling::xhtml:p" />
      </description>
    </item>
  </xsl:template>
  
  <xsl:template match="text()" />
  
  </xsl:stylesheet>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.