<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>

<xsl:template match="news">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
  <channel rdf:about="http://edhel.gimp.org/devnews.html">
    <title><xsl:value-of select="title"/></title>
    <link>http://edhel.gimp.org/devnews.html</link>
    <description>Weekly GIMP development news</description>
    <items>
      <rdf:Seq>
      <xsl:for-each select="//week[position() &lt; 5]">
        <rdf:li>
        <xsl:attribute name="resource">http://edhel.gimp.org/devnews.html#<xsl:value-of select="normalize-space(parent::year/text())"/>-<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
        </rdf:li>
      </xsl:for-each>
      </rdf:Seq>
    </items>
  </channel>
  <xsl:apply-templates select="//week[position() &lt; 5]"/>
</rdf:RDF>
</xsl:template>

<xsl:template match="week">
  <item xmlns="http://purl.org/rss/1.0/">
    <xsl:attribute name="rdf:about">http://edhel.gimp.org/devnews.html#<xsl:value-of select="normalize-space(parent::year/text())"/>-<xsl:value-of select="normalize-space(text())"/></xsl:attribute>
    <title>Week #<xsl:value-of select="normalize-space(text())"/> (<xsl:value-of select="range"/>)</title>
    <link>http://edhel.gimp.org/devnews.html#<xsl:value-of select="normalize-space(parent::year/text())"/>-<xsl:value-of select="normalize-space(text())"/></link>
    <dc:date><xsl:value-of select="dateRSS1"/></dc:date>
    <description>
      &lt;div style="border: 1px solid black; background: #fffff0; margin-bottom: 20px; padding: 0px 20px 20px 20px;"&gt;
      &lt;p style="font-size: larger; font-weight: bold; background: transparent; display: block;"&gt;Week #<xsl:value-of select="normalize-space(text())"/> (<xsl:value-of select="range"/>)&lt;/p&gt;
      <xsl:apply-templates select="announce"/>
      <xsl:apply-templates select="source"/>
      &lt;/div&gt;
    </description>
  </item>
</xsl:template>

<xsl:template match="announce">
  &lt;em&gt;<xsl:value-of select="."/>&lt;/em&gt;
</xsl:template>

<xsl:template match="source">
  &lt;p style="font-weight: bold; background: transparent; display: block;"&gt;<xsl:value-of select="normalize-space(text())"/>&lt;/p&gt;
  &lt;div style="border: 1px dotted black; background: white; margin: 0px 20px 0px 40px; padding: 0px 20px;"&gt;
    <xsl:apply-templates select="item"/>
  &lt;/div&gt;
</xsl:template>

<xsl:template match="item">
  &lt;p style="background: transparent; display: block;"&gt;&lt;span style="font-weight: bold; color:
  <xsl:choose>
    <xsl:when test="@type='misc'">gray</xsl:when>
    <xsl:when test="@type='usability'">green</xsl:when>
    <xsl:when test="@type='ui'">darkcyan</xsl:when>
    <xsl:when test="@type='pdb'">brown</xsl:when>
    <xsl:when test="@type='tool'">blue</xsl:when>
    <xsl:when test="@type='plug-in'">darkviolet</xsl:when>
    <xsl:when test="@type='script-fu' or @type='python'">coral</xsl:when>
    <xsl:when test="@type='data'">chocolate</xsl:when>
    <xsl:when test="@type='algo'">orangered</xsl:when>
    <xsl:when test="@type='perf'">red</xsl:when>
    <xsl:when test="@type='build'">deeppink</xsl:when>
    <xsl:when test="@type='release'">limegreen</xsl:when>
    <xsl:when test="@type='docs'">violet</xsl:when>
    <xsl:when test="@type='i18n'">orange</xsl:when>
    <xsl:when test="@type='soc'">dodgerblue</xsl:when>
    <xsl:when test="@type='gegl'">lightseagreen</xsl:when>
    <xsl:when test="@type='installer'">darkgoldenrod</xsl:when>
    <xsl:when test="@type='meet'">mediumturquoise</xsl:when>
  </xsl:choose>
  ;"&gt;
  [<xsl:value-of select="translate(@type,$lcletters,$ucletters)"/>]
  &lt;/span&gt; <xsl:apply-templates/>&lt;/p&gt;
</xsl:template>

<xsl:template match="bug">
  &lt;a href="http://bugzilla.gnome.org/show_bug.cgi?id=<xsl:value-of select="@num"/>"&gt;<xsl:value-of select="."/>&lt;/a&gt;
</xsl:template>

<xsl:template match="attach">
  &lt;a href="http://bugzilla.gnome.org/attachment.cgi?id=<xsl:value-of select="@num"/>&amp;action=view"&gt;<xsl:value-of select="."/>&lt;/a&gt;
</xsl:template>

<xsl:template match="a">
  &lt;a href="<xsl:value-of select="@href"/>"&gt;<xsl:value-of select="."/>&lt;/a&gt;
</xsl:template>

<xsl:template match="ul">
  &lt;ul&gt;<xsl:apply-templates/>&lt;/ul&gt;
</xsl:template>

<xsl:template match="li">
  &lt;li&gt;<xsl:apply-templates/>&lt;/li&gt;
</xsl:template>

</xsl:transform>
