<?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
# list of articles which are published
# 0:articleID ~ 1:article num ~ 2:Theme ~ 3:Issue ~ 4:Issue numeric ~ 

</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:variable name="status">
      <xsl:value-of select="../../issues/issue[@id=$issueid]/status"/>
    </xsl:variable>
    <xsl:if test="$status='published'">
      <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:if>
    <xsl:text> 
</xsl:text>
  </xsl:template>

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

</xsl:stylesheet>
