OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK-APPS: RFCs Bibliography für DocBook



Under http://xml.resource.org/ you can get the RFC bibliography in XML
format.  Since I have some RFCs in my books bibliography I've written
some scripts to get the xml files and transform them into something
docbook like format.  I think that might be useful for others, so her
it goes.  First the script to get the files:

------------------- use axe here -------------------------
#!/bin/bash

> rfc-index.tmp
while read rfc ; do
   echo "http://xml.resource.org/public/rfc/bibxml/reference.RFC.$rfc.xml"; >> rfc-index.tmp
done << EOT
0768
0791
0792
0793
EOT

wget -O rfc-index.xml.tmp -i rfc-index.tmp

( echo "<references>";
sed -e "/<!DOCTYPE/d" \
    -e "/<?xml/g" ;
echo "</references>" ) < rfc-index.xml.tmp > rfc-index.xml

exit
------------------- use axe here -------------------------

And now the XSL style to transform the result into Docbook (not yet
verified):

------------------- use axe here -------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:output method="xml"
    indent="yes"/>

  <xsl:strip-space elements="*"/>

  <xsl:template match="references">
    <bibliography>
      <title>RFC-Verzeichnis</title>
      <xsl:apply-templates/>
    </bibliography>
  </xsl:template>

  <xsl:template match="reference">
    <bibliomixed>
      <xsl:attribute name="if">
        <xsl:value-of select="translate(@anchor,'RFC','rfc')"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </bibliomixed>
  </xsl:template>

  <xsl:template match="title">
    <title><xsl:apply-templates/></title>,
  </xsl:template>

  <xsl:template name="process.author">
    <xsl:choose>
      <xsl:when test="@fullname!=''">
        <xsl:value-of select="@fullname"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="organization"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="author[1]">
    <author><othername><xsl:call-template name="process.author"/>
    <xsl:for-each select="following-sibling::author">
      <xsl:text>, </xsl:text>
      <xsl:value-of select="@fullname"/>
    </xsl:for-each>
  </othername></author>,
  </xsl:template>

  <xsl:template match="date">
    <pubdate>
      <xsl:variable name="day">
        <xsl:value-of select="@day"/>
      </xsl:variable>
      <xsl:if test="$day != ''">
        <xsl:value-of select="@day"/>
        <xsl:text>. </xsl:text>
      </xsl:if>
      <xsl:value-of select="@month"/>
      <xsl:text> </xsl:text>
      <xsl:value-of select="@year"/>
    </pubdate>.
  </xsl:template>

  <xsl:template match="abstract|organization|address"/>

</xsl:stylesheet>
------------------- use axe here -------------------------

Comments are welcome.

Jochen

-- 
#include <~/.signature>: permission denied


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC