<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns="http://purl.org/rss/1.0/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:dcterms="http://purl.org/dc/terms/"
   xmlns:html="http://www.w3.org/1999/xhtml" 
   xmlns:content="http://purl.org/rss/1.0/modules/content/"  
   xmlns:admin="http://webns.net/mvcb/" 
   exclude-result-prefixes="html"
   version="1.0" >

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
  <rdf:RDF>
    <xsl:apply-templates/>
  </rdf:RDF>
</xsl:template>

<xsl:template match="html:body">
   <channel rdf:about="http://inamidst.com/misc/updates">
      <title>inamidst.com updates</title>
      <link>http://inamidst.com/misc/updates</link>
      <description>recent changes to the inamidst.com site</description>
      <language>en-gb</language>
      <webMaster>Sean B. Palmer</webMaster>
      <!-- @@ 
         <lastBuildDate>$W3CDTF</lastBuildDate>
         <pubDate>$W3CDTF</pubDate>
      -->
      <items>
         <rdf:Seq>
            <rdf:li rdf:resource="http://inamidst.com/misc/updates#news" />
            <xsl:for-each select="./html:h2[@id]">
               <rdf:li rdf:resource="http://inamidst.com/misc/updates#{@id}" />
            </xsl:for-each>
         </rdf:Seq>
      </items>
   </channel>

   <item rdf:about="http://inamidst.com/misc/updates#news">
      <title>Updates News!</title>
      <description>
      <![CDATA[
         <p>Hi Jonas and Terje, and anyone else subscribed to this feed...</p>
         <p>Updates, including this feed, is now obsolete. There is a new <a 
         href="http://inamidst.com/changes/">Changes and Updates</a> page on 
         inamidst with a new <a href="http://inamidst.com/changes/feed">atom 
         feed</a>. You should probably subscribe there now instead of here. 
         Sorry for the inconvenience, but the new feed is much better, seeing 
         as how all of the changes presented are real changesets (so old items 
         won't change), and it provides links to <em>diffs</em> of what's 
         changed.</p>
         <p>Enjoy! --<a href="http://inamidst.com/sbp/">Sean B. Palmer</a></p>
      ]]>
      </description>
      <content:encoded>
      <![CDATA[
         <p>Hi Jonas and Terje, and anyone else subscribed to this feed...</p>
         <p>Updates, including this feed, is now obsolete. There is a new <a 
         href="http://inamidst.com/changes/">Changes and Updates</a> page on 
         inamidst with a new <a href="http://inamidst.com/changes/feed">atom 
         feed</a>. You should probably subscribe there now instead of here. 
         Sorry for the inconvenience, but the new feed is much better, seeing 
         as how all of the changes presented are real changesets (so old items 
         won't change), and it provides links to <em>diffs</em> of what's 
         changed.</p>
         <p>Enjoy! --<a href="http://inamidst.com/sbp/">Sean B. Palmer</a></p>
      ]]>
      </content:encoded>
      <link>http://inamidst.com/misc/updates#news</link>
      <dc:creator>Sean B. Palmer</dc:creator>
   </item>

   <xsl:for-each select="./html:h2[@id]">
      <item rdf:about="http://inamidst.com/misc/updates#{@id}">
         <title>Updates for: <xsl:value-of select="."/></title>
         <description><xsl:call-template name="desc"/></description>
         <content:encoded><xsl:call-template name="desc"/></content:encoded>
         <link><xsl:value-of 
             select="concat('http://inamidst.com/misc/updates#', @id)"/></link>
         <dc:creator>Sean B. Palmer</dc:creator>
      </item>
   </xsl:for-each>
</xsl:template>

<xsl:template name="desc">
   &lt;ul>
   <xsl:for-each select="following-sibling::html:ul[position()=1]/html:li">
      <xsl:variable name="path"><xsl:value-of 
          select="./html:a/@href"/></xsl:variable>
      &lt;li>&lt;a href="http://inamidst.com<xsl:value-of select="$path"/>">
         <xsl:value-of select="."/>
      &lt;/a>&lt;/li>
   </xsl:for-each>
   &lt;/ul>
</xsl:template>

<!-- good ol' "don't pass text thru" -->
<xsl:template match="text()|@*">
</xsl:template>

</xsl:stylesheet>
