1 <?xml version="1.0" encoding="utf-8"?>
 
   4         This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
 
   5         Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
 
   8 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
   9         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 
  10         xmlns:dc="http://purl.org/dc/elements/1.1/"
 
  11         xmlns="http://www.gribuser.ru/xml/fictionbook/2.0">
 
  13         <!-- description parsing -->
 
  14         <xsl:template match="rdf:Description" mode="outer">
 
  16                         <!-- need to keep ordering here... -->
 
  19                                 <!-- obligatory: genre, author, book-title, lang -->
 
  22                                 <genre>literature</genre> 
 
  23                                 <xsl:apply-templates mode="description"
 
  25                                 <xsl:apply-templates mode="description"
 
  27                                 <xsl:apply-templates mode="description"
 
  29                                 <xsl:apply-templates mode="description"
 
  30                                         select="dc:language"/>
 
  33                                 <!-- obligatory: author, date, id, version -->
 
  35                                 <xsl:apply-templates mode="description"
 
  36                                         select="dc:contributor.editor"/>
 
  37                                 <xsl:apply-templates mode="description"
 
  38                                         select="dc:contributor.technical_editor"/>
 
  39                                 <program-used>book2fb2</program-used>
 
  40                                 <!-- maybe today's date instead? -->
 
  41                                 <xsl:apply-templates mode="description"
 
  43                                 <xsl:apply-templates mode="description"
 
  44                                         select="dc:identifier.url"/>
 
  50                                         <xsl:for-each select="//dc:publisher/text()">
 
  51                                                 <xsl:value-of select="."/>
 
  52                                                 <xsl:if test="not(position() = last())">; </xsl:if>
 
  59         <xsl:template mode="description"
 
  60                         match="dc:creator|dc:contributor.editor|dc:contributor.technical_editor">
 
  61                 <!-- last name, first name -->
 
  62                 <xsl:variable name="last"
 
  63                         select="normalize-space(substring-before(., ','))"/>
 
  64                 <xsl:variable name="first"
 
  65                         select="normalize-space(substring-after(., ','))"/>
 
  68                         <first-name><xsl:value-of select="$first"/></first-name>
 
  69                         <last-name><xsl:value-of select="$last"/></last-name>
 
  72         <xsl:template mode="description" match="dc:title">
 
  73                 <book-title><xsl:value-of select="."/></book-title>
 
  75         <xsl:template mode="description" match="dc:language">
 
  76                 <lang><xsl:value-of select="."/></lang>
 
  78         <xsl:template mode="description" match="dc:date.pd|dc:date">
 
  79                 <date><xsl:value-of select="."/></date>
 
  81         <xsl:template mode="description" match="dc:publisher">
 
  82                 <publisher><xsl:value-of select="."/></publisher>
 
  84         <xsl:template mode="description" match="dc:identifier.url">
 
  85                 <id><xsl:value-of select="."/></id>