<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- XSLT stylesheet to transform a XML bibliography in DocBook -->

<!-- $Id: 2629toresources.xsl,v 1.3 2007/06/06 10:14:30 bortzmeyer Exp $ -->

  <xsl:output method="xml"    
    doctype-system="internet.dtd"/>

  <xsl:template match="/">
    <xsl:comment><xsl:text>&#10;DO NOT EDIT! Automatically produced by </xsl:text> 
    <xsl:value-of select="system-property('xsl:vendor')"/><xsl:text> (</xsl:text>
    <xsl:value-of select="system-property('xsl:vendor-url')"/><xsl:text>)</xsl:text>
    <xsl:text>&#10;</xsl:text></xsl:comment>
    <xsl:text>&#10;</xsl:text>
    <xsl:apply-templates select="rfc"/>
  </xsl:template>

  <xsl:template match="rfc">
    <bibliography><title>RFC</title>
      <xsl:apply-templates select="back/references/reference"/>
    </bibliography>
  </xsl:template>

  <xsl:template match="reference">
    <xsl:variable name="id"><xsl:value-of select="substring-after(@anchor,'RFC')"/></xsl:variable>
   <rfc><xsl:attribute name="num"><xsl:value-of select="$id"/></xsl:attribute>
     <xsl:apply-templates select="front/author"/>
    <xsl:text>&#10;</xsl:text>
     <xsl:apply-templates select="front/title"/>
    <xsl:text>&#10;</xsl:text>
     <xsl:apply-templates select="front/date"/>
    <xsl:text>&#10;</xsl:text>
   </rfc>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

  <xsl:template match="title">
    <title>
      <xsl:apply-templates select="text()"/>
    </title>
  </xsl:template>

  <xsl:template match="author">
    <author>
     <firstname>
      <xsl:value-of select="@initials"/>
     </firstname>
     <lastname>
      <xsl:value-of select="@surname"/>
     </lastname>
    </author>
  </xsl:template>

  <xsl:template match="date">
     <year>
      <xsl:value-of select="@year"/>
     </year>
     <month>
      <xsl:value-of select="@month"/>
     </month>
  </xsl:template>

  <xsl:template match="*">
  </xsl:template>

</xsl:stylesheet>

