<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0"
>
<xsl:output method="text"/>
<xsl:strip-space elements="t abstract organization phone email title"/>


<xsl:template match="reference">
rfc_cite:<xsl:value-of select="@anchor"/>
          <xsl:apply-templates select="seriesInfo"/>
          dc:title """ <xsl:value-of select="front/title/child::text()"/> """ ;
          <xsl:apply-templates select="front/abstract"/>
          <xsl:apply-templates select="front/area/text()"/>
          <xsl:apply-templates select="front/workgroup/text()"/>
          <xsl:apply-templates select="front/keyword/text()"/>
          rfc2629:date [
              rfc2629:year "<xsl:value-of select="front/date/@year"/>" ;
              rfc2629:month "<xsl:value-of select="front/date/@month"/>" ;
              rfc2629:day "<xsl:value-of select="front/date/@day"/>" ;
          ] ;
          <xsl:apply-templates select="front/author"/>
          .
</xsl:template>

<xsl:template match="seriesInfo">
          a ietf:<xsl:value-of select="@name"/> ;
          dc:identifier "<xsl:value-of select="@value"/>" ;
</xsl:template>

<xsl:template match="front/area/text()">
          rfc2629:area "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="front/workgroup/text()">
          rfc2629:workgroup "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="front/keyword/text()">
          dc:subject "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="front/abstract">
          dc:description """ <xsl:apply-templates/> """ ;</xsl:template>

<xsl:template match="front/author">
          rfc2629:author [ 
             a foaf:Person ;
             foaf:surname "<xsl:value-of select="@surname"/>" ;
             foaf:name """<xsl:value-of select="@fullname"/>""" ;
             <xsl:apply-templates select="organization/text()"/>
             <xsl:apply-templates select="address/phone/text()"/>
             <xsl:apply-templates select="address/facsimile/text()"/>
             <xsl:apply-templates select="address/email/text()"/>
             <xsl:apply-templates select="address/postal"/>
          ] ;
</xsl:template>


<xsl:template match="organization/text()">
             foaf:organization """ <xsl:value-of select="."/> """ ;</xsl:template>

<xsl:template match="address/phone/text()">
             rfc2629:phone "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="address/facsimile/text()">
             rfc2629:fax "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="address/email/text()">
             foaf:mbox "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="address/postal">
             rfc2629:postal [
               <xsl:apply-templates select="street[1]/text()"/>
               <xsl:apply-templates select="street[2]/text()"/>
               <xsl:apply-templates select="city/text()"/>
               <xsl:apply-templates select="region/text()"/>
               <xsl:apply-templates select="code/text()"/>
               <xsl:apply-templates select="country/text()"/>
             ] ;
</xsl:template>

<xsl:template match="street[1]/text()">
               foaf:street1 "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="street[2]/text()">
               foaf:street2 "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="city/text()">
               foaf:city "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="region/text()">
               foaf:area "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="code/text()">
               foaf:postcode "<xsl:value-of select="."/>" ;</xsl:template>

<xsl:template match="country/text()">
               foaf:country "<xsl:value-of select="."/>" ;</xsl:template>

</xsl:stylesheet>
