<?xml version="1.0"?>
<!-- vim: set sw=2 ts=2 et tw=80: -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" omit-xml-declaration="yes"  encoding="ISO-8859-1" media-type="text"/>
  <xsl:template match="/">
<xsl:text># db generated from xmldb_en.xml
# 0:articleID ~ 1:article num ~ 2:Theme ~ 3:Issue ~ 4:Issue numeric ~ 
# 5:Issue status ~ 6:title ~ 7:filename ~ 8:personid ~ 9:Author email ~ 
# 10:Author name (ascii) ~ 11:Author name (html) ~ 12:Abstract ~

</xsl:text>
    <xsl:for-each select="database/articles/article">
      <xsl:apply-templates select="."/>
    </xsl:for-each>
  </xsl:template>
    
  <xsl:template match="article">
    <xsl:variable name="issueid">
      <xsl:value-of select="issueref/@href"/>
    </xsl:variable>
    <xsl:variable name="personid">
      <xsl:value-of select="personref/@href"/>
    </xsl:variable>
    <xsl:value-of select="@id"/>~<xsl:value-of select="substring(@id,8)"/>~<xsl:value-of select="theme/@id"/>~<xsl:value-of select="$issueid"/>~<xsl:apply-templates select="../../issues/issue[@id=$issueid]"/>~<xsl:value-of select="normalize-space(title)"/>~<xsl:value-of select="file"/>~<xsl:value-of select="$personid"/>~<xsl:apply-templates select="../../persons/person[@id=$personid]"/>~<xsl:value-of select="normalize-space(abstract)"/>~
    <xsl:text> 
</xsl:text>
  </xsl:template>

  <xsl:template match="issue">
    <xsl:value-of select="@code"/>~<xsl:value-of select="status"/>
  </xsl:template>

  <xsl:template match="person">
    <xsl:value-of select="email"/>~<xsl:value-of select="asciiname"/>~<xsl:value-of select="htmlname"/>
  </xsl:template>

</xsl:stylesheet>
