suppress xmlns:... attributes in epub
[librarian.git] / librarian / fb2 / description.xslt
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3
4         This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
5         Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6
7 -->
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">
12
13         <!-- description parsing -->
14         <xsl:template match="rdf:Description" mode="outer">
15                 <description>
16                         <!-- need to keep ordering here... -->
17
18                         <title-info>
19                                 <!-- obligatory: genre, author, book-title, lang -->
20
21                                 <!-- XXX -->
22                                 <genre>literature</genre> 
23                                 <xsl:apply-templates mode="description"
24                                         select="dc:creator"/>
25                                 <xsl:apply-templates mode="description"
26                                         select="dc:title"/>
27                                 <xsl:apply-templates mode="description"
28                                         select="dc:date.pd"/>
29                                 <xsl:apply-templates mode="description"
30                                         select="dc:language"/>
31                         </title-info>
32                         <document-info>
33                                 <!-- obligatory: author, date, id, version -->
34
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"
42                                         select="dc:date"/>
43                                 <xsl:apply-templates mode="description"
44                                         select="dc:identifier.url"/>
45                                 <!-- XXX -->
46                                 <version>0</version>
47                         </document-info>
48                         <publish-info>
49                                 <xsl:apply-templates mode="description"
50                                         select="dc:publisher"/>
51                         </publish-info>
52                 </description>
53         </xsl:template>
54
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(., ','))"/>
62
63                 <author>
64                         <first-name><xsl:value-of select="$first"/></first-name>
65                         <last-name><xsl:value-of select="$last"/></last-name>
66                 </author>
67         </xsl:template>
68         <xsl:template mode="description" match="dc:title">
69                 <book-title><xsl:value-of select="."/></book-title>
70         </xsl:template>
71         <xsl:template mode="description" match="dc:language">
72                 <lang><xsl:value-of select="."/></lang>
73         </xsl:template>
74         <xsl:template mode="description" match="dc:date.pd|dc:date">
75                 <date><xsl:value-of select="."/></date>
76         </xsl:template>
77         <xsl:template mode="description" match="dc:publisher">
78                 <publisher><xsl:value-of select="."/></publisher>
79         </xsl:template>
80         <xsl:template mode="description" match="dc:identifier.url">
81                 <id><xsl:value-of select="."/></id>
82         </xsl:template>
83 </xsl:stylesheet>