blob: 50eb8065029eafd38225f402cb21651404dc07cf [file] [log] [blame]
Marc Kupietz7cc8fc72024-05-26 16:49:38 +02001<?xml version="1.0" encoding="UTF-8"?>
Marc Kupietz1a422662024-03-16 09:34:10 +01002<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 xmlns:opf="http://www.idpf.org/2007/opf"
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:ids="http://www.ids-mannheim.de/ids"
7 xmlns:hlu="http://www.ids-mannheim.de/hlu"
8 xmlns:saxon="http://saxon.sf.net/"
9 xmlns:xhtml="http://www.w3.org/1999/xhtml"
Marc Kupietz10903f32024-04-14 14:21:18 +020010 xmlns:map="http://www.w3.org/2005/xpath-functions/map"
Rebecca Wilme5f055a2024-05-10 15:07:50 +020011 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12 xmlns:srw="http://www.loc.gov/zing/srw/"
13 xmlns:oai="http://www.openarchives.org/OAI/2.0/oai_dc/"
14 exclude-result-prefixes="xs opf dc ids hlu map saxon xhtml xsi srw oai">
Marc Kupietz1a422662024-03-16 09:34:10 +010015
16 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" saxon:line-length="1000"/>
17 <xsl:strip-space elements="*"/>
18
Marc Kupietz7f3fe792024-07-26 15:28:26 +020019 <xsl:param name="debug"/>
20
Marc Kupietz1a422662024-03-16 09:34:10 +010021 <xsl:variable name="ev"/>
22 <xsl:variable name="x"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020023
Marc Kupietz0df2a572024-05-26 16:54:27 +020024 <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*' , '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010025
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020026 <xsl:variable name="idno_type">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020027 <xsl:choose>
28 <xsl:when test="starts-with($idno,'1')">
29 <xsl:value-of select="'IDN'"/>
30 </xsl:when>
31 <xsl:otherwise>
32 <xsl:value-of select="'ISBN'"/>
33 </xsl:otherwise>
34 </xsl:choose>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020035 </xsl:variable>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020036
Marc Kupietz1c3ebca2024-09-22 13:49:28 +020037 <xsl:param name="buchpreis"/>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020038
Marc Kupietz0df2a572024-05-26 16:54:27 +020039 <xsl:variable name="dnbBookdataQuery" as="xs:string">
40 <xsl:value-of disable-output-escaping="yes" select="concat('https://services.dnb.de/sru/dnb?version=1.1&amp;operation=searchRetrieve&amp;query=', $idno_type, '%3D', $idno, '&amp;recordSchema=oai_dc')"/>
41 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010042 <xsl:variable name="dnbBookdata">
Marc Kupietzcff63c02024-09-28 23:11:18 +020043 <xsl:copy-of select="if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno] else doc($dnbBookdataQuery)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010044 </xsl:variable>
45
46 <xsl:variable name="autor"
Marc Kupietzde2ca532024-04-26 16:50:53 +020047 select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietzeaa90132024-04-26 18:14:40 +020048 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
49 <xsl:variable name="translator"
50 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
51 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010052
Marc Kupietz15e7d612024-04-26 18:16:39 +020053 <xsl:variable name="herausgeber"
54 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
55 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010056
57 <xsl:variable name="ina"/>
58 <xsl:variable name="_corpus"/>
59 <xsl:variable name="ent_known"/>
60
61
62 <!-- added HLU 2012-02-09: -->
63 <xsl:variable name="ent">
64 <xsl:choose>
65 <xsl:when test="$ent_known">
66 <xsl:value-of select="$ent_known"/>
67 </xsl:when>
68 <xsl:when test="$ev">
69 <xsl:value-of select="$ev"/>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$j"/>
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:variable>
76
77 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020078 <xsl:variable name="title-with-subtitles">
79 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020080 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
Marc Kupietz744d30e2024-09-22 12:49:45 +020081 <xsl:choose>
82 <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')">
83 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
87 </xsl:otherwise>
88 </xsl:choose>
Marc Kupietz49124fa2024-04-10 16:50:01 +020089 </xsl:when>
Marc Kupietzb9903542024-09-30 14:02:18 +020090 <xsl:when test="contains(($dnbBookdata//dc:title)[1],'/')">
Marc Kupietz6cb52232024-04-13 12:28:44 +020091 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietzb9903542024-09-30 14:02:18 +020092 </xsl:when>
93 <xsl:otherwise>
94 <xsl:value-of select="normalize-space(($dnbBookdata//dc:title)[1])"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020095 </xsl:otherwise>
96 </xsl:choose>
97 </xsl:variable>
98 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010099 </xsl:variable>
100
101 <xsl:variable name="erscheinungsort">
102 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200103 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
104 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100105 </xsl:when>
106 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200107 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100108 </xsl:otherwise>
109 </xsl:choose>
110 </xsl:variable>
111
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200112 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
113
Marc Kupietz6cb52232024-04-13 12:28:44 +0200114 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100115
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200116 <xsl:variable name="genretable">
117 <genres>
Nicolas Arnold32118802024-05-31 17:10:05 +0200118 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
119 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
120 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200121 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
122 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200123 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
124 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200125 <genre keyRegex="western" genre="Roman: Westernroman"/>
126 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200127 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
128 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
129 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
130 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
131 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
132 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200133 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
Nicolas Arnold32118802024-05-31 17:10:05 +0200134 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL -->
135 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200136 <genre keyRegex="erzählung" genre="Erzählung"/>
137 <genre keyRegex="novelle" genre="Novelle"/>
138 <genre keyRegex="anthologie" genre="Anthologie"/>
139 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200140 <genre keyRegex="geschichte" genre="Erzählung"/>
141 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200142 <genre keyRegex="roman" genre="Roman"/>
143 <genre keyRegex="." genre="Roman"/>
144 </genres>
145 </xsl:variable>
146
147 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100148 <xsl:variable name="verlag">
149 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200150 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
151 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100152 </xsl:when>
153 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200154 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100155 </xsl:otherwise>
156 </xsl:choose>
157 </xsl:variable>
158
159 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200160 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100161 </xsl:variable>
162
163 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +0200164 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100165
Marc Kupietza5d01182024-04-14 12:24:02 +0200166 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100167
168 <!-- for BOT+s: -->
169 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
170
171 <!-- fuer BOT+b: -->
172 <xsl:variable name="_b">
173 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
174 <xsl:choose>
175 <xsl:when test="matches($dnbBookdata, $regexp1)">
176 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
177 <xsl:matching-substring>
178 <xsl:value-of select="."/>
179 </xsl:matching-substring>
180 </xsl:analyze-string>
181 </xsl:when>
182 <xsl:otherwise>
183 <xsl:value-of select="'.'"/>
184 </xsl:otherwise>
185 </xsl:choose>
186 </xsl:variable>
187
188 <!-- for BOT+x: -->
189 <xsl:variable name="txtart">
190 <xsl:choose>
191 <xsl:when test="$x">
192 <xsl:value-of select="concat('[', $x, ']')"/>
193 </xsl:when>
194 <xsl:when
Nicolas Arnold26355632024-05-10 15:25:41 +0200195 test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100196 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200197 select="concat('[', replace(replace($untertitel, '.*?(((^|\P{L})\p{L}+)?([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)).*', '$1'), '\P{L}*(.+)', '$1'), ']')"
Marc Kupietz1a422662024-03-16 09:34:10 +0100198 />
199 </xsl:when>
200 <xsl:otherwise>
201 <xsl:value-of>Roman</xsl:value-of>
202 </xsl:otherwise>
203 </xsl:choose>
204 </xsl:variable>
205
206
207
208 <!-- fuer BOTd: -->
209 <xsl:variable name="dok"
210 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
211
212 <!-- END variables derived from sru request to dnb archive -->
213
214
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200215 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100216
217 <!-- for BOTD: -->
218 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
219 <xsl:variable name="doc_sigle">
220 <xsl:variable name="firstContentWordTitleInitial">
221 <xsl:variable name="helper">
222 <xsl:analyze-string select="$titel" regex="\w+">
223 <xsl:matching-substring>
224 <xsl:choose>
225 <xsl:when
Marc Kupietzad1f3b82024-04-19 19:21:49 +0200226 test="matches(.,'^[A-Z]') and not(matches(.,'^(Der|Die|Das|Des|Ein|Eine|Eines|Einmal|Von|Mit|Zu|Zur)$'))">
Marc Kupietz1a422662024-03-16 09:34:10 +0100227 <!-- TODO: Fktnswoerter nachtragen -->
228 <xsl:sequence select="."/>
229 </xsl:when>
230 <xsl:otherwise/>
231 </xsl:choose>
232 </xsl:matching-substring>
233 </xsl:analyze-string>
234 </xsl:variable>
235 <xsl:value-of
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200236 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100237 <!-- longest match of .+ -->
238 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200239 <xsl:variable name="authorInitials">
240 <xsl:choose>
241 <xsl:when test="contains($autor,';')">
242 <xsl:variable name="lastname_aut1"
243 select="upper-case(substring(normalize-space($autor),1,1))"/>
244 <xsl:variable name="lastname_aut2"
245 select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
246 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:variable name="lastname_aut1"
250 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
251 <xsl:variable name="firstname_aut1"
252 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
253 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
254 </xsl:otherwise>
255 </xsl:choose>
256 </xsl:variable>
Marc Kupietz398b5962024-04-21 17:51:34 +0200257 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100258 </xsl:variable>
259
260
Marc Kupietz0c246632024-04-29 07:08:23 +0200261 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100262 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
263
264 <!-- fuer BOT+xy: (?) -->
265 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200266 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100267 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200268 <xsl:text>IDNO:</xsl:text>
269 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100270 <xsl:text>; </xsl:text>
271 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
272 </xsl:variable>
273
Marc Kupietzb660ed62024-03-16 11:45:53 +0100274 <xsl:variable name="long-reference"
275 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
276
277 <xsl:variable name="short-reference"
278 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100279
280 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200281 <!-- for debugging purposes
282 <xsl:message select="concat('uri: ', base-uri())"/>
283 <xsl:message select="concat('idno: ', $idno)"/>
284
285 <xsl:message>
286 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
287 </xsl:message>
288
289 <xsl:message>
290 <xsl:copy-of select="$dnbBookdata"/>
291 </xsl:message>
292 -->
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200293 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200294 <xsl:message terminate="yes">ERROR: No dc:date found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200295 </xsl:if>
296
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200297 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200298 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200299 </xsl:if>
300
Marc Kupietz2badfb12024-04-19 12:59:40 +0200301 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200302 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200303 </xsl:if>
304
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200305 <xsl:if test="not(matches($sigle, '^[A-Z]{2,3}[0-9]{2}/[A-Z]{2,3}\.[0-9]{5}$'))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200306 <xsl:message terminate="yes">ERROR: Invalid sigle »<xsl:value-of select="$sigle"/>« for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz09745e12024-04-21 12:54:10 +0200307 </xsl:if>
308
Marc Kupietz1a422662024-03-16 09:34:10 +0100309 <idsDoc TEIform="TEI.2" type="text" version="1.0">
310 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
311 <fileDesc>
312 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100313 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
314 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100315 </titleStmt>
316 <publicationStmt>
317 <distributor/>
318 <pubAddress/>
319 <availability region="world" status="unknown">QAO-NC</availability>
320 <pubDate/>
321 </publicationStmt>
322 <sourceDesc>
323 <biblStruct>
324 <monogr>
325 <h.title type="main"/>
326 <imprint/>
327 </monogr>
328 </biblStruct>
329 </sourceDesc>
330 </fileDesc>
331 </idsHeader>
332 <idsText version="1.0">
333 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
334 <fileDesc>
335 <titleStmt>
336 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100337 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100338 </titleStmt>
339 <publicationStmt>
340 <distributor/>
341 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200342 <xsl:for-each select="$dnbBookdata//dc:identifier">
343 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
344 <xsl:choose>
345 <xsl:when test="@xsi:type='tel:ISBN'">
346 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
347 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
348 </xsl:if>
349 </xsl:when>
Marc Kupietz7582d572024-07-25 16:55:20 +0200350 <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')">
351 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200352 </xsl:when>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200353 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
354 </xsl:choose>
355 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100356 <availability region="world" status="unknown">QAO-NC</availability>
357 <pubDate/>
358 </publicationStmt>
359 <sourceDesc>
360 <biblStruct>
361 <monogr>
362 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
363 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
364 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200365 <xsl:if test="$translator">
366 <editor role="translator"><xsl:value-of select="$translator"/></editor>
367 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200368 <xsl:if test="$herausgeber">
369 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
370 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100371 <edition>
372 <further/>
373 <kind>E-Book-Ausgabe</kind>
374 <appearance>EPUB-Datei</appearance>
375 </edition>
376 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100377 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100378 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
379 <pubDate type="month"/>
380 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200381 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100382 </imprint>
383 <biblScope type="subsume"/>
384 <biblScope type="pp"/>
385 <biblScope type="vol"/>
386 <biblScope type="volume-title"/>
387 </monogr>
Marc Kupietz1c3ebca2024-09-22 13:49:28 +0200388 <xsl:if test="$buchpreis">
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200389 <xsl:element name="note">
390 <xsl:attribute name="type">award</xsl:attribute>
391 <xsl:attribute name="subtype">
Marc Kupietze43c7202024-09-22 12:53:41 +0200392 <xsl:value-of select="'Buchpreis deutscher_buchpreis'"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200393 </xsl:attribute>
394 </xsl:element>
395 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100396 </biblStruct>
397 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100398 </sourceDesc>
399 </fileDesc>
400 <profileDesc>
401 <creation>
402 <creatDate><xsl:value-of select="$j"/></creatDate>
403 </creation>
404 <textClass/>
405 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200406 <textType><xsl:value-of select="$textFullGenre"/></textType>
407 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100408 <textDomain/>
409 </textDesc>
410 </profileDesc>
411 </idsHeader>
412 <text>
413 <body>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200414 <!-- Call the template for each idref the spine -->
415 <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100416 </body>
417 </text>
418 </idsText>
419 </idsDoc>
420 </xsl:template>
421
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200422 <xsl:template match="opf:itemref" mode="collect">
423 <xsl:variable name="id" select="@idref"/>
424 <xsl:variable name="item" select="//opf:manifest/opf:item[@id=$id and matches(@href, '\.x?html?$') and not(matches(@href, '(cover|toc|copyright|feedback|inhalt|nav|titlepage).*'))]"/>
425
426 <xsl:choose>
427 <xsl:when test = "$item">
428 <xsl:variable name="href" select="$item/@href"/>
429 <xsl:if test="$debug">
430 <xsl:message>
431 <xsl:text>converting: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
432 </xsl:message>
433 </xsl:if>
434 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
435 </xsl:when>
436 <xsl:otherwise>
437 <xsl:if test="$debug">
438 <xsl:message>
439 <xsl:text>skipping: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
440 </xsl:message>
441 </xsl:if>
442 </xsl:otherwise>
443 </xsl:choose>
444 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100445
446 <xsl:template match="xhtml:body">
447 <div type="chapter">
448 <xsl:apply-templates/>
449 </div>
450 </xsl:template>
451
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000452 <xsl:template match="xhtml:body/text()">
453 <p>
454 <xsl:value-of select="."/>
455 </p>
456 </xsl:template>
457
Marc Kupietz1a422662024-03-16 09:34:10 +0100458 <xsl:template match="xhtml:title">
459 <head>
460 <xsl:apply-templates/>
461 </head>
462 </xsl:template>
463
464 <xsl:template match="xhtml:h1">
465 <head>
466 <xsl:apply-templates/>
467 </head>
468 </xsl:template>
469
Marc Kupietz3989c742024-04-21 17:33:49 +0200470 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100471 <head type="sub">
472 <xsl:apply-templates/>
473 </head>
474 </xsl:template>
475
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100476 <xsl:template match="xhtml:em">
477 <emph>
478 <xsl:apply-templates/>
479 </emph>
480 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100481
Marc Kupietz30cc0802024-04-10 16:37:04 +0200482 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
483 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
484 <hi rend="{$class}">
485 <xsl:apply-templates/>
486 </hi>
487 </xsl:template>
488
Marc Kupietzad4d4462024-04-26 17:43:08 +0200489 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200490 <xsl:apply-templates/>
491 </xsl:template>
492
Marc Kupietz3989c742024-04-21 17:33:49 +0200493 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200494 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100495 <xsl:apply-templates/>
496 </hi>
497 </xsl:template>
498
Nicolas Arnoldc169e832024-06-07 08:44:11 +0200499 <xsl:template match="xhtml:i|xhtml:span[@class='i' or @class='it' or @class='Italic']|xhtml:span[@style='font-style:italic' or @style='font-style:italic;']">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000500 <hi rend="italic">
501 <xsl:apply-templates/>
502 </hi>
503 </xsl:template>
504
505
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100506 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100507 <hi rend="sub">
508 <xsl:apply-templates/>
509 </hi>
510 </xsl:template>
511
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100512 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100513 <hi rend="sup">
514 <xsl:apply-templates/>
515 </hi>
516 </xsl:template>
517
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000518 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100519
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200520 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
521 <xsl:apply-templates/>
522 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000523 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100524 <p>
525 <xsl:apply-templates/>
526 </p>
527 </xsl:template>
528
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000529 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
530 <div type="section">
531 <xsl:apply-templates/>
532 </div>
533 </xsl:template>
534
535 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
536 <div type="section">
537 <p>
538 <xsl:apply-templates/>
539 </p>
540 </div>
541 </xsl:template>
542
543 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
544 <xsl:if test="normalize-space(.)">
545 <p>
546 <xsl:apply-templates/>
547 </p>
548 </xsl:if>
549 </xsl:template>
550
551 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
552 <xsl:if test="normalize-space(.)">
553 <div type="section">
554 <xsl:apply-templates/>
555 </div>
556 </xsl:if>
557 </xsl:template>
558
Marc Kupietz09745e12024-04-21 12:54:10 +0200559 <xsl:template match="xhtml:ul">
560 <list type="unordered">
561 <xsl:apply-templates/>
562 </list>
563 </xsl:template>
564 <xsl:template match="xhtml:ol">
565 <list type="ordered">
566 <xsl:apply-templates/>
567 </list>
568 </xsl:template>
569 <xsl:template match="xhtml:li">
570 <item>
571 <xsl:apply-templates/>
572 </item>
573 </xsl:template>
574 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200575 <!-- <gap reason="toc"/> -->
576 </xsl:template>
577
Marc Kupietz1a422662024-03-16 09:34:10 +0100578 <xsl:template match="xhtml:img">
579 <!-- <gap reason="image"/> -->
580 </xsl:template>
581
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200582 <xsl:template match="xhtml:audio">
583 <!-- <gap reason="audio"/> -->
584 </xsl:template>
585
Marc Kupietz09745e12024-04-21 12:54:10 +0200586 <xsl:template match="xhtml:table">
587 <!-- <gap reason="table"/> -->
588 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000589 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200590 <xsl:if test="normalize-space(.)">
591 <p>
592 <ref target="{@href}">
593 <xsl:apply-templates />
594 </ref>
595 </p>
596 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000597 </xsl:template>
598
599 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200600 <xsl:if test="$debug">
601 <xsl:message>
602 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
603 </xsl:message>
604 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000605 <div type="section">
606 <p>
607 <xsl:value-of select="."/>
608 </p>
609 </div>
610 </xsl:template>
611 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200612 <xsl:if test="$debug">
613 <xsl:message>
614 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
615 </xsl:message>
616 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000617 <xsl:value-of select="."/>
618 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100619 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200620 <xsl:if test="normalize-space(.)">
621 <ref target="{@href}">
622 <xsl:apply-templates />
623 </ref>
624 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100625 </xsl:template>
626
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200627 <xsl:template match="xhtml:br">
628 <lb/><xsl:text>&#10;</xsl:text>
629 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100630
Marc Kupietz1a422662024-03-16 09:34:10 +0100631 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200632 <xsl:if test="$debug">
633 <xsl:message>
634 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
635 </xsl:message>
636 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000637 <xsl:choose>
638 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
639 <div type="section">
640 <xsl:apply-templates/>
641 </div>
642 </xsl:when>
643 <xsl:otherwise>
644 <xsl:apply-templates select="./*|node()"/>
645 </xsl:otherwise>
646 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100647 <xsl:apply-templates/>
648 </xsl:template>
649
650 <xsl:function name="ids:reversedAuthors">
651 <xsl:param name="s" />
652 <xsl:value-of
653 select="
654 if (matches($s, ';')) then
655 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
656 else
657 replace($s, '(.+) (.+)', '$2, $1')"
658 />
659 </xsl:function>
660
661 <xsl:function name="hlu:reversedAuthors">
662 <xsl:param name="s"/>
663 <xsl:value-of
664 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
665 />
666 </xsl:function>
667
Marc Kupietz10903f32024-04-14 14:21:18 +0200668 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
669 <xsl:map>
670 <xsl:map-entry key="'Axams'" select="'AT'"/>
671 <xsl:map-entry key="'Vienna'" select="'AT'"/>
672 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
673 <xsl:map-entry key="'Graz'" select="'AT'"/>
674 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
675 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
676 <xsl:map-entry key="'Bern'" select="'CH'"/>
677 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
678 <xsl:map-entry key="'Zurich'" select="'CH'"/>
679 <xsl:map-entry key="'Basel'" select="'CH'"/>
680 <xsl:map-entry key="'Geneva'" select="'CH'"/>
681 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
682 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
683 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
684 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
685 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
686 <xsl:map-entry key="'Brussels'" select="'BE'"/>
687 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
688 <xsl:map-entry key="'Ghent'" select="'BE'"/>
689 <xsl:map-entry key="'Bruges'" select="'BE'"/>
690 <xsl:map-entry key="'Leuven'" select="'BE'"/>
691 <xsl:map-entry key="'Liege'" select="'BE'"/>
692 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
693 <xsl:map-entry key="'Namur'" select="'BE'"/>
694 <xsl:map-entry key="'Mons'" select="'BE'"/>
695 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
696 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
697 <xsl:map-entry key="'colatina'" select="'BR'"/>
698 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
699 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
700 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
701 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
702 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
703 <xsl:map-entry key="'Victoria'" select="'CA'"/>
704 <xsl:map-entry key="'Wien'" select="'AT'"/>
705 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
706 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
707 <xsl:map-entry key="'Zürich'" select="'CH'"/>
708 <xsl:map-entry key="'Zug'" select="'CH'"/>
709 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
710 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200711
Marc Kupietz10903f32024-04-14 14:21:18 +0200712 </xsl:variable>
713
714 <!-- Define the function -->
715 <xsl:function name="ids:country-city" as="xs:string">
716 <xsl:param name="city" as="xs:string"/>
717 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
718 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100719</xsl:stylesheet>