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 Nowoczesna Polska. 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"/>
49 <xsl:apply-templates mode="description"
50 select="dc:publisher"/>
55 <xsl:template mode="description"
56 match="dc:creator|dc:contributor.editor|dc:contributor.technical_editor">
57 <!-- last name, first name -->
58 <xsl:variable name="last"
59 select="normalize-space(substring-before(., ','))"/>
60 <xsl:variable name="first"
61 select="normalize-space(substring-after(., ','))"/>
64 <first-name><xsl:value-of select="$first"/></first-name>
65 <last-name><xsl:value-of select="$last"/></last-name>
68 <xsl:template mode="description" match="dc:title">
69 <book-title><xsl:value-of select="."/></book-title>
71 <xsl:template mode="description" match="dc:language">
72 <lang><xsl:value-of select="."/></lang>
74 <xsl:template mode="description" match="dc:date.pd|dc:date">
75 <date><xsl:value-of select="."/></date>
77 <xsl:template mode="description" match="dc:publisher">
78 <publisher><xsl:value-of select="."/></publisher>
80 <xsl:template mode="description" match="dc:identifier.url">
81 <id><xsl:value-of select="."/></id>