-
Notifications
You must be signed in to change notification settings - Fork 0
/
editedbook.xsl
145 lines (138 loc) · 4.22 KB
/
editedbook.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://www.tei-c.org/ns/1.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:z="http://www.zotero.org/namespaces/export#" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:bib="http://purl.org/net/biblio#"
xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vcard="http://nwalsh.com/rdf/vCard#"
xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/" version="2.0">
<xsl:template name="editedbook">
<bib:Book>
<!--id in zotero ?? attributed by the system?-->
<xsl:attribute name="rdf:about">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
<z:itemType>
<xsl:text>book</xsl:text>
</z:itemType>
<!--series-->
<xsl:if test="t:title[@level = 's'][1]">
<!--check-->
<dcterms:isPartOf>
<bib:Series>
<dc:title>
<xsl:value-of select="normalize-space(t:title[@level = 's'][1])"/>
</dc:title>
<dc:identifier>
<xsl:value-of
select="normalize-space(t:title[@level = 's'][1]/following-sibling::t:biblScope[@unit = 'vol'][1])"
/>
</dc:identifier>
</bib:Series>
</dcterms:isPartOf>
</xsl:if>
<!--publisher-->
<dc:publisher>
<foaf:Organization>
<vcard:adr>
<vcard:Address>
<!--place of publication-->
<vcard:locality>
<xsl:value-of select="normalize-space(t:pubPlace[1])"/>
<!--<check></check>-->
</vcard:locality>
</vcard:Address>
</vcard:adr>
<!--publisher name-->
<foaf:name>
<xsl:value-of select="normalize-space(t:publisher)"/>
</foaf:name>
</foaf:Organization>
</dc:publisher>
<bib:authors>
<rdf:Seq>
<!--editors-->
<xsl:for-each select="t:editor">
<rdf:li>
<foaf:Person>
<foaf:surname>
<xsl:value-of select="normalize-space(t:name[@type = 'surname'])"/>
</foaf:surname>
<foaf:givenname>
<xsl:choose>
<xsl:when test="contains(., ', ')">
<xsl:value-of
select="replace(substring-after(normalize-space(.), ', '), '\(eds.\)', '')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="replace(substring-before(normalize-space(.), ' '), '\(eds.\)', '')"
/>
</xsl:otherwise>
</xsl:choose>
</foaf:givenname>
</foaf:Person>
</rdf:li>
</xsl:for-each>
</rdf:Seq>
</bib:authors>
<!--tags-->
<dc:subject>
<xsl:value-of select="@xml:id"/>
</dc:subject>
<!--title-->
<dc:title>
<xsl:value-of select="normalize-space(t:title[@level = 'm'])"/>
</dc:title>
<!--volume-->
<prism:volume>
<xsl:value-of
select="normalize-space(t:title[@level = 'm']/following-sibling::t:biblScope[@unit = 'vol'][matches(., '\d+') or matches(., 'vol.')][1])"
/>
</prism:volume>
<!--journaltitle-->
<xsl:if test="t:title[@level = 'j']">
<dcterms:isPartOf>
<bib:Journal>
<dc:title>
<xsl:value-of select="normalize-space(t:title[@level = 'j'])"/>
</dc:title>
<prism:volume>
<xsl:value-of
select="normalize-space(t:title[@level = 'j']/following-sibling::t:biblScope[@unit = 'issue'])"
/>
</prism:volume>
</bib:Journal>
</dcterms:isPartOf>
</xsl:if>
<!--date-->
<xsl:for-each select="t:date">
<dc:date>
<xsl:value-of select="normalize-space(.)"/>
</dc:date>
</xsl:for-each>
<!--pages-->
<bib:pages>
<xsl:value-of select="normalize-space(t:biblScope[@unit = 'pp'])"/>
</bib:pages>
<!--number of volumes-->
<xsl:if test="contains(., 'vols.')">
<z:numberOfVolumes>
<xsl:analyze-string select="." regex="\s(\d+)\s(vols\.)">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
</xsl:matching-substring>
</xsl:analyze-string>
</z:numberOfVolumes>
</xsl:if>
<!--notes-->
<xsl:if test="t:note">
<bib:Memo>
<rdf:value>
<xsl:value-of select="normalize-space(replace(t:note, ':', ''))"/>
</rdf:value>
</bib:Memo>
</xsl:if>
</bib:Book>
</xsl:template>
</xsl:stylesheet>