<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
                xmlns:rss="http://purl.org/rss/1.0/"
                xmlns:dc="http://purl.org/dc/elements/1.1/"
	        xmlns:html="http://www.w3.org/1999/xhtml">

<!-- $Id: html2blog.xsl,v 1.7 2005/03/20 22:53:57 dajobe Exp $ -->

<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="no" />

<xsl:template match="/">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rss="http://purl.org/rss/1.0/">
<xsl:text>

</xsl:text>
<xsl:for-each select="//html:h2[starts-with(., 'Regular')]//following-sibling::html:ul[1]/html:li">
    <xsl:apply-templates select="." />
  </xsl:for-each>
  </rdf:RDF>
<xsl:text> 
</xsl:text>
</xsl:template>


<xsl:template match="html:li">
 <xsl:variable name="id" select="generate-id(.)"/>
 <xsl:variable name="rss" select="html:a[normalize-space()='RSS 1.0']/@href"/>

  <xsl:choose>
    <xsl:when test="$rss != ''">

      <foaf:Agent rdf:nodeID="{$id}">
<xsl:choose>
  <xsl:when test="html:a//following-sibling::html:span[1]/@class='personalname'">
	<xsl:text> 
</xsl:text>
	      <foaf:name><xsl:value-of select="html:a/html:span"/></foaf:name>
	<xsl:text> 
</xsl:text>
	      <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person" />
  </xsl:when>
  <xsl:when test="html:a//html:span/@class='personalname'">
	<xsl:text> 
</xsl:text>
	      <foaf:name><xsl:value-of select="html:a/html:span"/></foaf:name>
  </xsl:when>
  <xsl:when test="html:a//html:span/@class='groupname'">
	<xsl:text> 
</xsl:text>
	      <foaf:name><xsl:value-of select="html:a/html:span"/></foaf:name>
  </xsl:when>

</xsl:choose>

	<xsl:text> 
</xsl:text>
	      <foaf:weblog>
	<xsl:text> 
</xsl:text>
	      <foaf:Document rdf:about="{html:a/@href}">
	<xsl:text> 
</xsl:text>
	      <dc:title><xsl:value-of select="html:a/@title"/></dc:title>
	<xsl:text> 
</xsl:text>
	      <rdfs:seeAlso>
	<xsl:text> 
</xsl:text>
		 <rss:channel rdf:about="{$rss}">
	<xsl:text> 
</xsl:text>
		    <foaf:maker rdf:nodeID="{$id}"/>
	<xsl:text> 
</xsl:text>
	            <foaf:topic rdf:resource="http://www.w3.org/2001/sw/"/>
	<xsl:text> 
</xsl:text>
	            <foaf:topic rdf:resource="http://www.w3.org/RDF/"/>
	<xsl:text> 
</xsl:text>
		 </rss:channel>
	<xsl:text> 
</xsl:text>
	      </rdfs:seeAlso>
	<xsl:text> 
</xsl:text>
	      </foaf:Document>
	<xsl:text> 
</xsl:text>
	      </foaf:weblog>
	<xsl:text> 
</xsl:text>
	      <foaf:interest rdf:resource="http://www.w3.org/2001/sw/"/>
	<xsl:text> 
</xsl:text>
	      <foaf:interest rdf:resource="http://www.w3.org/RDF/"/>
	<xsl:text> 
</xsl:text>
	 </foaf:Agent>
      <xsl:text> 

</xsl:text>

    </xsl:when>
  </xsl:choose>

</xsl:template>

</xsl:stylesheet>
