1<?xml version="1.0" encoding="UTF-8"?> 2<xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:h="http://www.w3.org/1999/xhtml" 5 xmlns="http://www.w3.org/2005/Atom" 6 exclude-result-prefixes="h"> 7 8<xsl:output method="xml" encoding="UTF-8" indent="yes" 9 media-type="application/atom+xml"/> 10 11<xsl:param name="host" select="'validator.w3.org'"/> 12<xsl:param name="self" select="concat('http://', $host, '/whatsnew.atom')"/> 13<xsl:param name="validator" 14 select="concat('http://', $host, '/whatsnew.html')"/> 15<!-- number of entries to be displayed in the feed --> 16<xsl:param name="limit" select="10"/> 17<xsl:param name="author" select="'The W3C Validator Team'"/> 18<!-- 19 feedvalidator.org complains about dates like YYYY-MM-DD not 20 being valid ISO datetimes, so we hack around it by setting 21 each item's publish time to 00:00:00 UTC 22--> 23<xsl:param name="faketime" select="'T00:00:00Z'"/> 24 25<xsl:template match="/"> 26<feed xml:lang="en"> 27 <title><xsl:value-of select="/h:html/h:head/h:title"/></title> 28 <updated> 29 <xsl:value-of 30 select="concat(substring-after(/h:html/h:body/*//h:dt[position()=1]/@id, 31 't'), $faketime)"/> 32 </updated> 33 <author> 34 <name><xsl:value-of select="$author"/></name> 35 </author> 36 <id><xsl:value-of select="$self"/></id> 37 <link href="{$validator}"/> 38 <link rel="self" href="{$self}"/> 39 40 <!-- entries --> 41 <xsl:apply-templates select="//h:dt[position() < $limit]"/> 42</feed> 43</xsl:template> 44 45<xsl:template match="h:dt"> 46<xsl:variable name="updated" select="substring-after(@id, 't')"/> 47 <entry> 48 <id><xsl:value-of 49 select="concat('tag:', $host, ',', $updated, ':', @id)"/></id> 50 <updated><xsl:value-of select="concat($updated, $faketime)"/></updated> 51 <link href="{concat($validator, '#', @id)}"/> 52 <title><xsl:value-of select="substring-before(., ':')"/></title> 53 <content xml:base="{$validator}" type="xhtml"> 54 <div xmlns="http://www.w3.org/1999/xhtml"> 55 <xsl:copy-of select="following::h:dd[position()=1]/node()"/> 56 </div> 57 </content> 58 </entry> 59</xsl:template> 60 61<xsl:template match="text()"> 62</xsl:template> 63 64</xsl:stylesheet> 65