blob: 2d0e6cc1d33ad6b9ae5e063b0a876f55c2ad4c31 [file] [log] [blame]
Marc Kupietz7cc8fc72024-05-26 16:49:38 +02001<?xml version="1.0" encoding="UTF-8"?>
Harald Luengen017ab122025-01-15 15:40:33 +01002<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:opf="http://www.idpf.org/2007/opf"
3 xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ids="http://www.ids-mannheim.de/ids" xmlns:hlu="http://www.ids-mannheim.de/hlu" xmlns:saxon="http://saxon.sf.net/"
4 xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:srw="http://www.loc.gov/zing/srw/"
5 xmlns:oai="http://www.openarchives.org/OAI/2.0/oai_dc/" exclude-result-prefixes="xs opf dc ids hlu map saxon xhtml xsi srw oai">
Marc Kupietz1a422662024-03-16 09:34:10 +01006
7 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" saxon:line-length="1000"/>
8 <xsl:strip-space elements="*"/>
9
Marc Kupietz7f3fe792024-07-26 15:28:26 +020010 <xsl:param name="debug"/>
11
Marc Kupietz1a422662024-03-16 09:34:10 +010012 <xsl:variable name="ev"/>
13 <xsl:variable name="x"/>
Harald Luengen017ab122025-01-15 15:40:33 +010014
15 <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010016
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020017 <xsl:variable name="idno_type">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020018 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +010019 <xsl:when test="starts-with($idno, '1')">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020020 <xsl:value-of select="'IDN'"/>
21 </xsl:when>
22 <xsl:otherwise>
23 <xsl:value-of select="'ISBN'"/>
24 </xsl:otherwise>
25 </xsl:choose>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020026 </xsl:variable>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020027
Marc Kupietz1c3ebca2024-09-22 13:49:28 +020028 <xsl:param name="buchpreis"/>
Harald Luengen017ab122025-01-15 15:40:33 +010029
Marc Kupietz0df2a572024-05-26 16:54:27 +020030 <xsl:variable name="dnbBookdataQuery" as="xs:string">
Harald Luengen017ab122025-01-15 15:40:33 +010031 <xsl:value-of disable-output-escaping="yes"
32 select="concat('https://services.dnb.de/sru/dnb?version=1.1&amp;operation=searchRetrieve&amp;query=', $idno_type, '%3D', $idno, '&amp;recordSchema=oai_dc')"/>
Marc Kupietz0df2a572024-05-26 16:54:27 +020033 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010034 <xsl:variable name="dnbBookdata">
Harald Luengen017ab122025-01-15 15:40:33 +010035 <xsl:if test="$debug">
36 <xsl:message select="concat('debug message dnbBookdataQuery: ', $dnbBookdataQuery)"/>
37 <xsl:message select="concat('debug message idno: ', $idno)"/>
38 <xsl:message select="
39 concat('debug message original title from static metadata: ', if (starts-with($idno, '8')) then
40 doc('static_metadata.xml')//oai:dc[dc:identifier = $idno]//dc:title
41 else
42 '')"/>
43 </xsl:if>
44 <xsl:variable name="tmp" select="
45 if (starts-with($idno, '8')) then
46 doc('static_metadata.xml')//oai:dc[dc:identifier = $idno]
47 else
48 doc($dnbBookdataQuery)"/>
49 <xsl:copy-of select="
50 if ($tmp//dc:title) then
51 $tmp
52 else
53 doc('static_metadata.xml')//oai:dc[replace(dc:identifier[@xsi:type = 'tel:ISBN'][1], '-', '') = $idno]"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010054 </xsl:variable>
55
Harald Luengen017ab122025-01-15 15:40:33 +010056 <xsl:variable name="autor" select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
57 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
58 <xsl:variable name="translator" select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
59 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010060
Harald Luengen017ab122025-01-15 15:40:33 +010061 <xsl:variable name="herausgeber" select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
62 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010063
64 <xsl:variable name="ina"/>
65 <xsl:variable name="_corpus"/>
66 <xsl:variable name="ent_known"/>
67
68
69 <!-- added HLU 2012-02-09: -->
70 <xsl:variable name="ent">
71 <xsl:choose>
72 <xsl:when test="$ent_known">
73 <xsl:value-of select="$ent_known"/>
74 </xsl:when>
75 <xsl:when test="$ev">
76 <xsl:value-of select="$ev"/>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:value-of select="$j"/>
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:variable>
83
84 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020085 <xsl:variable name="title-with-subtitles">
Harald Luengen017ab122025-01-15 15:40:33 +010086 <xsl:if test="$debug">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +020087 <xsl:message select="concat('title: ', ($dnbBookdata//dc:title)[1])"/>
88 </xsl:if>
Marc Kupietz49124fa2024-04-10 16:50:01 +020089 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +010090 <xsl:when test="contains(($dnbBookdata//dc:title)[1], ':')">
Marc Kupietz744d30e2024-09-22 12:49:45 +020091 <xsl:choose>
92 <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')">
93 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/>
94 </xsl:when>
95 <xsl:otherwise>
96 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
97 </xsl:otherwise>
98 </xsl:choose>
Marc Kupietz49124fa2024-04-10 16:50:01 +020099 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100100 <xsl:when test="contains(($dnbBookdata//dc:title)[1], '/')">
Marc Kupietz6cb52232024-04-13 12:28:44 +0200101 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100102 </xsl:when>
Marc Kupietzb9903542024-09-30 14:02:18 +0200103 <xsl:otherwise>
104 <xsl:value-of select="normalize-space(($dnbBookdata//dc:title)[1])"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +0200105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:variable>
108 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100109 </xsl:variable>
110
111 <xsl:variable name="erscheinungsort">
112 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200113 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
114 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100115 </xsl:when>
116 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200117 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100118 </xsl:otherwise>
119 </xsl:choose>
120 </xsl:variable>
121
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200122 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
123
Marc Kupietz6cb52232024-04-13 12:28:44 +0200124 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100125
Harald Luengen017ab122025-01-15 15:40:33 +0100126 <xsl:variable name="genretable">
127 <genres>
128 <genre keyRegex="true.*crime" genre="Roman: True Crime"/>
129 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
130 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
131 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
132 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
133 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
134 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
135 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
136 <genre keyRegex="western" genre="Roman: Westernroman"/>
137 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
138 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
139 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
140 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
141 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
142 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
143 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
144 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
145 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/>
146 <!-- wie in KJL -->
147 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
148 <genre keyRegex="erzählung" genre="Erzählung"/>
149 <genre keyRegex="novelle" genre="Novelle"/>
150 <genre keyRegex="anthologie" genre="Anthologie"/>
151 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
152 <genre keyRegex="geschichte" genre="Erzählung"/>
153 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
154 <genre keyRegex="roman" genre="Roman"/>
155 <genre keyRegex="." genre="Roman"/>
156 </genres>
157 </xsl:variable>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200158
Harald Luengen017ab122025-01-15 15:40:33 +0100159 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100160 <xsl:variable name="verlag">
161 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200162 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
163 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100164 </xsl:when>
165 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200166 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100167 </xsl:otherwise>
168 </xsl:choose>
169 </xsl:variable>
170
171 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200172 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100173 </xsl:variable>
174
Harald Luengen017ab122025-01-15 15:40:33 +0100175 <xsl:variable name="untertitel" select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100176
Marc Kupietza5d01182024-04-14 12:24:02 +0200177 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100178
179 <!-- for BOT+s: -->
Harald Luengen017ab122025-01-15 15:40:33 +0100180 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format, 'S\.', '')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100181
182 <!-- fuer BOT+b: -->
183 <xsl:variable name="_b">
184 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
185 <xsl:choose>
186 <xsl:when test="matches($dnbBookdata, $regexp1)">
187 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
188 <xsl:matching-substring>
189 <xsl:value-of select="."/>
190 </xsl:matching-substring>
191 </xsl:analyze-string>
192 </xsl:when>
193 <xsl:otherwise>
194 <xsl:value-of select="'.'"/>
195 </xsl:otherwise>
196 </xsl:choose>
197 </xsl:variable>
198
199 <!-- for BOT+x: -->
200 <xsl:variable name="txtart">
201 <xsl:choose>
202 <xsl:when test="$x">
203 <xsl:value-of select="concat('[', $x, ']')"/>
204 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100205 <xsl:when test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100206 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200207 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'), ']')"
Harald Luengen017ab122025-01-15 15:40:33 +0100208 />
Marc Kupietz1a422662024-03-16 09:34:10 +0100209 </xsl:when>
210 <xsl:otherwise>
211 <xsl:value-of>Roman</xsl:value-of>
212 </xsl:otherwise>
213 </xsl:choose>
214 </xsl:variable>
215
216
217
218 <!-- fuer BOTd: -->
Harald Luengen017ab122025-01-15 15:40:33 +0100219 <xsl:variable name="dok" select="
220 concat((if (string-length($autor) &gt; 0) then
221 concat($straight_autor, ': ')
222 else
223 ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100224
225 <!-- END variables derived from sru request to dnb archive -->
226
227
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200228 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100229
230 <!-- for BOTD: -->
231 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
232 <xsl:variable name="doc_sigle">
233 <xsl:variable name="firstContentWordTitleInitial">
234 <xsl:variable name="helper">
235 <xsl:analyze-string select="$titel" regex="\w+">
236 <xsl:matching-substring>
237 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100238 <xsl:when 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 +0100239 <!-- TODO: Fktnswoerter nachtragen -->
240 <xsl:sequence select="."/>
241 </xsl:when>
242 <xsl:otherwise/>
243 </xsl:choose>
244 </xsl:matching-substring>
245 </xsl:analyze-string>
246 </xsl:variable>
Harald Luengen017ab122025-01-15 15:40:33 +0100247 <xsl:value-of select="upper-case(substring(normalize-space(replace($helper, '\s+.+$', '')), 1, 3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100248 <!-- longest match of .+ -->
249 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200250 <xsl:variable name="authorInitials">
251 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100252 <xsl:when test="contains($autor, ';')">
253 <xsl:variable name="lastname_aut1" select="upper-case(substring(normalize-space($autor), 1, 1))"/>
254 <xsl:variable name="lastname_aut2" select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
255 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200256 </xsl:when>
257 <xsl:otherwise>
Harald Luengen017ab122025-01-15 15:40:33 +0100258 <xsl:variable name="lastname_aut1" select="upper-case(substring(normalize-space(substring-before($autor, ',')), 1, 1))"/>
259 <xsl:variable name="firstname_aut1" select="upper-case(substring(normalize-space(substring-after($autor, ',')), 1, 1))"/>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200260 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
261 </xsl:otherwise>
262 </xsl:choose>
263 </xsl:variable>
Harald Luengen017ab122025-01-15 15:40:33 +0100264 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials, $firstContentWordTitleInitial), 'NFKD'), '[^A-Z]', ''), 1, 3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100265 </xsl:variable>
266
267
Marc Kupietz0c246632024-04-29 07:08:23 +0200268 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100269 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
270
271 <!-- fuer BOT+xy: (?) -->
272 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200273 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100274 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200275 <xsl:text>IDNO:</xsl:text>
276 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100277 <xsl:text>; </xsl:text>
278 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
279 </xsl:variable>
280
Harald Luengen017ab122025-01-15 15:40:33 +0100281 <xsl:variable name="long-reference" select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100282
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100283 <!-- NA -->
Harald Luengen017ab122025-01-15 15:40:33 +0100284 <xsl:variable name="bot_title" select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100285 <!-- end NA -->
286
Harald Luengen017ab122025-01-15 15:40:33 +0100287 <xsl:variable name="short-reference" select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100288
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100289
Marc Kupietz1a422662024-03-16 09:34:10 +0100290 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200291 <!-- for debugging purposes
292 <xsl:message select="concat('uri: ', base-uri())"/>
293 <xsl:message select="concat('idno: ', $idno)"/>
294
295 <xsl:message>
296 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
297 </xsl:message>
298
299 <xsl:message>
300 <xsl:copy-of select="$dnbBookdata"/>
301 </xsl:message>
302 -->
Harald Luengen017ab122025-01-15 15:40:33 +0100303
304
305 <xsl:if test="not($dnbBookdata//oai:dc)">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +0200306 <xsl:message terminate="yes" default-mode="text">ERROR: No metadata found for IDNO: <xsl:value-of select="$idno"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100307 <xsl:text>&#10;Query was: </xsl:text>
308 <xsl:value-of disable-output-escaping="yes" select="replace($dnbBookdataQuery, '&amp;', '%38')"/>
309 <xsl:text>&#10;Retrieved response: </xsl:text>
310 <xsl:copy-of select="$dnbBookdata"/>
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +0200311 </xsl:message>
312 </xsl:if>
313
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200314 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200315 <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 +0200316 </xsl:if>
317
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200318 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200319 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200320 </xsl:if>
321
Marc Kupietz2badfb12024-04-19 12:59:40 +0200322 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200323 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200324 </xsl:if>
325
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200326 <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 +0200327 <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 +0200328 </xsl:if>
329
Marc Kupietz1a422662024-03-16 09:34:10 +0100330 <idsDoc TEIform="TEI.2" type="text" version="1.0">
331 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
332 <fileDesc>
333 <titleStmt>
Harald Luengen017ab122025-01-15 15:40:33 +0100334 <dokumentSigle>
335 <xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/>
336 </dokumentSigle>
337 <d.title>
338 <xsl:value-of select="$short-reference"/>
339 </d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100340 </titleStmt>
341 <publicationStmt>
342 <distributor/>
343 <pubAddress/>
344 <availability region="world" status="unknown">QAO-NC</availability>
345 <pubDate/>
346 </publicationStmt>
347 <sourceDesc>
348 <biblStruct>
349 <monogr>
350 <h.title type="main"/>
351 <imprint/>
352 </monogr>
353 </biblStruct>
354 </sourceDesc>
355 </fileDesc>
356 </idsHeader>
357 <idsText version="1.0">
358 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
359 <fileDesc>
360 <titleStmt>
Harald Luengen017ab122025-01-15 15:40:33 +0100361 <textSigle>
362 <xsl:sequence select="$sigle"/>
363 </textSigle>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100364 <!-- NA -->
Harald Luengen017ab122025-01-15 15:40:33 +0100365 <t.title assemblage="regular">
366 <xsl:value-of select="$bot_title"/>
367 </t.title>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100368 <!-- end NA -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100369 </titleStmt>
370 <publicationStmt>
371 <distributor/>
372 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200373 <xsl:for-each select="$dnbBookdata//dc:identifier">
374 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
375 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100376 <xsl:when test="@xsi:type = 'tel:ISBN'">
377 <xsl:if test="matches(., '(^([0-9]|-)+X?).*')">
378 <idno type="{$type}">
379 <xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/>
380 </idno>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200381 </xsl:if>
382 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100383 <xsl:when test="$type = 'URL' and contains(., '/urn:nbn:de')">
384 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL">
385 <xsl:value-of select="."/>
386 </idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200387 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100388 <xsl:otherwise>
389 <idno type="{$type}">
390 <xsl:value-of select="."/>
391 </idno>
392 </xsl:otherwise>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200393 </xsl:choose>
394 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100395 <availability region="world" status="unknown">QAO-NC</availability>
396 <pubDate/>
397 </publicationStmt>
398 <sourceDesc>
399 <biblStruct>
400 <monogr>
Harald Luengen017ab122025-01-15 15:40:33 +0100401 <h.title type="main">
402 <xsl:value-of select="$titel"/>
403 </h.title>
404 <h.title type="sub">
405 <xsl:value-of select="$untertitel"/>
406 </h.title>
407 <h.author>
408 <xsl:value-of select="$autor"/>
409 </h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200410 <xsl:if test="$translator">
Harald Luengen017ab122025-01-15 15:40:33 +0100411 <editor role="translator">
412 <xsl:value-of select="$translator"/>
413 </editor>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200414 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200415 <xsl:if test="$herausgeber">
Harald Luengen017ab122025-01-15 15:40:33 +0100416 <editor role="editor">
417 <xsl:value-of select="$herausgeber"/>
418 </editor>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200419 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100420 <edition>
421 <further/>
422 <kind>E-Book-Ausgabe</kind>
423 <appearance>EPUB-Datei</appearance>
424 </edition>
425 <imprint>
Harald Luengen017ab122025-01-15 15:40:33 +0100426 <publisher>
427 <xsl:value-of select="$verlag"/>
428 </publisher>
429 <pubDate type="year">
430 <xsl:value-of select="$j"/>
431 </pubDate>
Marc Kupietz1a422662024-03-16 09:34:10 +0100432 <pubDate type="month"/>
433 <pubDate type="day"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100434 <pubPlace key="{$erscheinungsland}">
435 <xsl:value-of select="$erscheinungsort"/>
436 </pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100437 </imprint>
438 <biblScope type="subsume"/>
439 <biblScope type="pp"/>
440 <biblScope type="vol"/>
441 <biblScope type="volume-title"/>
442 </monogr>
Marc Kupietz1c3ebca2024-09-22 13:49:28 +0200443 <xsl:if test="$buchpreis">
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200444 <xsl:element name="note">
445 <xsl:attribute name="type">award</xsl:attribute>
446 <xsl:attribute name="subtype">
Marc Kupietze43c7202024-09-22 12:53:41 +0200447 <xsl:value-of select="'Buchpreis deutscher_buchpreis'"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200448 </xsl:attribute>
449 </xsl:element>
450 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100451 </biblStruct>
Harald Luengen017ab122025-01-15 15:40:33 +0100452 <!-- NA -->
453 <reference assemblage="regular" type="complete">
454 <xsl:value-of select="$long-reference"/>
455 </reference>
456 <reference assemblage="regular" type="short">
457 <xsl:value-of select="$short-reference"/>
458 </reference>
459 <!-- END NA -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100460 </sourceDesc>
461 </fileDesc>
462 <profileDesc>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100463 <!-- outcommented HL -->
464 <!--creation>
Marc Kupietz1a422662024-03-16 09:34:10 +0100465 <creatDate><xsl:value-of select="$j"/></creatDate>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100466 </creation-->
467 <!-- BEGIN HL -->
468 <xsl:call-template name="creation_temp">
469 <xsl:with-param name="j" select="$j"/>
470 </xsl:call-template>
471 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100472 <textClass/>
473 <textDesc>
Harald Luengen017ab122025-01-15 15:40:33 +0100474 <textType>
475 <xsl:value-of select="$textFullGenre"/>
476 </textType>
477 <textTypeRef>
478 <xsl:value-of select="replace($textFullGenre, '.*: *', '')"/>
479 </textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100480 <textDomain/>
481 </textDesc>
482 </profileDesc>
483 </idsHeader>
484 <text>
Harald Luengen017ab122025-01-15 15:40:33 +0100485 <body>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200486 <!-- Call the template for each idref the spine -->
487 <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100488 </body>
489 </text>
490 </idsText>
491 </idsDoc>
492 </xsl:template>
Harald Luengen017ab122025-01-15 15:40:33 +0100493
Harald Luengenb81b63b2025-01-09 15:44:14 +0100494 <!-- BEGIN HL -->
495 <xsl:template name="creation_temp">
496 <xsl:param name="j"/>
497 <creation>
Harald Luengen017ab122025-01-15 15:40:33 +0100498 <creatDate>
499 <xsl:value-of select="$j"/>
500 </creatDate>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100501 </creation>
502 </xsl:template>
503 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100504
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200505 <xsl:template match="opf:itemref" mode="collect">
506 <xsl:variable name="id" select="@idref"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100507 <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).*'))]"/>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200508
509 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100510 <xsl:when test="$item">
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200511 <xsl:variable name="href" select="$item/@href"/>
512 <xsl:if test="$debug">
513 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100514 <xsl:text>converting: </xsl:text>
515 <xsl:value-of select="$id"/>
516 <xsl:text> </xsl:text>
517 <xsl:value-of select="$href"/>
518 <xsl:text> </xsl:text>
519 <xsl:value-of select="$idno"/>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200520 </xsl:message>
521 </xsl:if>
522 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
523 </xsl:when>
524 <xsl:otherwise>
525 <xsl:if test="$debug">
526 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100527 <xsl:text>skipping: </xsl:text>
528 <xsl:value-of select="$id"/>
529 <xsl:text> </xsl:text>
530 <xsl:value-of select="$idno"/>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200531 </xsl:message>
532 </xsl:if>
533 </xsl:otherwise>
534 </xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100535 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100536
537 <xsl:template match="xhtml:body">
538 <div type="chapter">
539 <xsl:apply-templates/>
540 </div>
541 </xsl:template>
542
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000543 <xsl:template match="xhtml:body/text()">
544 <p>
545 <xsl:value-of select="."/>
546 </p>
547 </xsl:template>
548
Marc Kupietz1a422662024-03-16 09:34:10 +0100549 <xsl:template match="xhtml:title">
550 <head>
551 <xsl:apply-templates/>
552 </head>
553 </xsl:template>
554
555 <xsl:template match="xhtml:h1">
556 <head>
557 <xsl:apply-templates/>
558 </head>
559 </xsl:template>
560
Harald Luengen017ab122025-01-15 15:40:33 +0100561 <xsl:template match="xhtml:h2 | xhtml:h3 | xhtml:h4 | xhtml:h5 | xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100562 <head type="sub">
563 <xsl:apply-templates/>
564 </head>
565 </xsl:template>
566
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100567 <xsl:template match="xhtml:em">
568 <emph>
569 <xsl:apply-templates/>
570 </emph>
571 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100572
Marc Kupietz30cc0802024-04-10 16:37:04 +0200573 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
574 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
575 <hi rend="{$class}">
576 <xsl:apply-templates/>
577 </hi>
578 </xsl:template>
579
Marc Kupietzad4d4462024-04-26 17:43:08 +0200580 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200581 <xsl:apply-templates/>
582 </xsl:template>
583
Harald Luengen017ab122025-01-15 15:40:33 +0100584 <xsl:template match="xhtml:b | xhtml:span[@class = 'b'] | xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200585 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100586 <xsl:apply-templates/>
587 </hi>
588 </xsl:template>
589
Harald Luengen017ab122025-01-15 15:40:33 +0100590 <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 +0000591 <hi rend="italic">
592 <xsl:apply-templates/>
593 </hi>
594 </xsl:template>
595
596
Harald Luengen017ab122025-01-15 15:40:33 +0100597 <xsl:template match="xhtml:sub | xhtml:span[@class = 'sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100598 <hi rend="sub">
599 <xsl:apply-templates/>
600 </hi>
601 </xsl:template>
602
Harald Luengen017ab122025-01-15 15:40:33 +0100603 <xsl:template match="xhtml:sup | xhtml:span[@class = 'sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100604 <hi rend="sup">
605 <xsl:apply-templates/>
606 </hi>
607 </xsl:template>
608
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000609 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100610
Harald Luengen017ab122025-01-15 15:40:33 +0100611 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1 | ./xhtml:h2 | ./xhtml:h3]" priority="1.0">
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200612 <xsl:apply-templates/>
613 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000614 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100615 <p>
616 <xsl:apply-templates/>
617 </p>
618 </xsl:template>
619
Harald Luengen017ab122025-01-15 15:40:33 +0100620 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p | descendant::xhtml:div)]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000621 <div type="section">
622 <xsl:apply-templates/>
623 </div>
624 </xsl:template>
625
Harald Luengen017ab122025-01-15 15:40:33 +0100626 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p | descendant::xhtml:div)]">
627 <div type="section">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000628 <p>
629 <xsl:apply-templates/>
630 </p>
631 </div>
632 </xsl:template>
633
Harald Luengen017ab122025-01-15 15:40:33 +0100634 <xsl:template match="xhtml:p[not(descendant::xhtml:p | descendant::xhtml:div)]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000635 <xsl:if test="normalize-space(.)">
636 <p>
637 <xsl:apply-templates/>
638 </p>
639 </xsl:if>
640 </xsl:template>
641
Harald Luengen017ab122025-01-15 15:40:33 +0100642 <xsl:template match="xhtml:p[descendant::xhtml:p | descendant::xhtml:div]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000643 <xsl:if test="normalize-space(.)">
644 <div type="section">
645 <xsl:apply-templates/>
646 </div>
647 </xsl:if>
648 </xsl:template>
649
Marc Kupietz09745e12024-04-21 12:54:10 +0200650 <xsl:template match="xhtml:ul">
651 <list type="unordered">
652 <xsl:apply-templates/>
653 </list>
654 </xsl:template>
655 <xsl:template match="xhtml:ol">
656 <list type="ordered">
657 <xsl:apply-templates/>
658 </list>
659 </xsl:template>
660 <xsl:template match="xhtml:li">
661 <item>
662 <xsl:apply-templates/>
Harald Luengen017ab122025-01-15 15:40:33 +0100663 </item>
Marc Kupietz09745e12024-04-21 12:54:10 +0200664 </xsl:template>
665 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200666 <!-- <gap reason="toc"/> -->
667 </xsl:template>
668
Marc Kupietz1a422662024-03-16 09:34:10 +0100669 <xsl:template match="xhtml:img">
670 <!-- <gap reason="image"/> -->
671 </xsl:template>
672
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200673 <xsl:template match="xhtml:audio">
674 <!-- <gap reason="audio"/> -->
675 </xsl:template>
676
Marc Kupietz09745e12024-04-21 12:54:10 +0200677 <xsl:template match="xhtml:table">
678 <!-- <gap reason="table"/> -->
679 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000680 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200681 <xsl:if test="normalize-space(.)">
682 <p>
683 <ref target="{@href}">
Harald Luengen017ab122025-01-15 15:40:33 +0100684 <xsl:apply-templates/>
Marc Kupietz164a2832024-04-14 21:00:48 +0200685 </ref>
686 </p>
687 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000688 </xsl:template>
689
Harald Luengen017ab122025-01-15 15:40:33 +0100690 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200691 <xsl:if test="$debug">
Harald Luengen017ab122025-01-15 15:40:33 +0100692 <xsl:message>
693 <xsl:text>unhandled span element: </xsl:text>
694 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200695 </xsl:message>
696 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000697 <div type="section">
698 <p>
Harald Luengen017ab122025-01-15 15:40:33 +0100699 <xsl:value-of select="."/>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000700 </p>
701 </div>
702 </xsl:template>
703 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200704 <xsl:if test="$debug">
705 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100706 <xsl:text>unhandled span element: </xsl:text>
707 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200708 </xsl:message>
709 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000710 <xsl:value-of select="."/>
711 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100712 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200713 <xsl:if test="normalize-space(.)">
714 <ref target="{@href}">
Harald Luengen017ab122025-01-15 15:40:33 +0100715 <xsl:apply-templates/>
Marc Kupietz164a2832024-04-14 21:00:48 +0200716 </ref>
717 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100718 </xsl:template>
719
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200720 <xsl:template match="xhtml:br">
Harald Luengen017ab122025-01-15 15:40:33 +0100721 <lb/>
722 <xsl:text>&#10;</xsl:text>
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200723 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100724
Marc Kupietz1a422662024-03-16 09:34:10 +0100725 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200726 <xsl:if test="$debug">
727 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100728 <xsl:text>unhandled element: </xsl:text>
729 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200730 </xsl:message>
731 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000732 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100733 <xsl:when test="descendant::xhtml:div | descendant::xhtml:p | parent::xhtml:body">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000734 <div type="section">
735 <xsl:apply-templates/>
736 </div>
737 </xsl:when>
738 <xsl:otherwise>
Harald Luengen017ab122025-01-15 15:40:33 +0100739 <xsl:apply-templates select="./* | node()"/>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000740 </xsl:otherwise>
741 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100742 <xsl:apply-templates/>
743 </xsl:template>
744
745 <xsl:function name="ids:reversedAuthors">
Harald Luengen017ab122025-01-15 15:40:33 +0100746 <xsl:param name="s"/>
747 <xsl:value-of select="
Marc Kupietz1a422662024-03-16 09:34:10 +0100748 if (matches($s, ';')) then
749 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
750 else
Harald Luengen017ab122025-01-15 15:40:33 +0100751 replace($s, '(.+) (.+)', '$2, $1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100752 </xsl:function>
753
754 <xsl:function name="hlu:reversedAuthors">
755 <xsl:param name="s"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100756 <xsl:value-of select="
757 if (matches($s, ';')) then
758 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
759 else
760 replace($s, '(.+),(.+)', '$2, $1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100761 </xsl:function>
762
Harald Luengen017ab122025-01-15 15:40:33 +0100763 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
764 <xsl:map>
765 <xsl:map-entry key="'Axams'" select="'AT'"/>
766 <xsl:map-entry key="'Vienna'" select="'AT'"/>
767 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
768 <xsl:map-entry key="'Graz'" select="'AT'"/>
769 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
770 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
771 <xsl:map-entry key="'Bern'" select="'CH'"/>
772 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
773 <xsl:map-entry key="'Zurich'" select="'CH'"/>
774 <xsl:map-entry key="'Basel'" select="'CH'"/>
775 <xsl:map-entry key="'Geneva'" select="'CH'"/>
776 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
777 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
778 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
779 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
780 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
781 <xsl:map-entry key="'Brussels'" select="'BE'"/>
782 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
783 <xsl:map-entry key="'Ghent'" select="'BE'"/>
784 <xsl:map-entry key="'Bruges'" select="'BE'"/>
785 <xsl:map-entry key="'Leuven'" select="'BE'"/>
786 <xsl:map-entry key="'Liege'" select="'BE'"/>
787 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
788 <xsl:map-entry key="'Namur'" select="'BE'"/>
789 <xsl:map-entry key="'Mons'" select="'BE'"/>
790 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
791 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
792 <xsl:map-entry key="'colatina'" select="'BR'"/>
793 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
794 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
795 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
796 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
797 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
798 <xsl:map-entry key="'Victoria'" select="'CA'"/>
799 <xsl:map-entry key="'Wien'" select="'AT'"/>
800 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
801 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
802 <xsl:map-entry key="'Zürich'" select="'CH'"/>
803 <xsl:map-entry key="'Zug'" select="'CH'"/>
804 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
805 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200806
Harald Luengen017ab122025-01-15 15:40:33 +0100807 </xsl:variable>
Marc Kupietz10903f32024-04-14 14:21:18 +0200808
Harald Luengen017ab122025-01-15 15:40:33 +0100809 <!-- Define the function -->
810 <xsl:function name="ids:country-city" as="xs:string">
811 <xsl:param name="city" as="xs:string"/>
812 <xsl:sequence select="
813 if (map:contains($city-country-map, $city)) then
814 map:get($city-country-map, $city)
815 else
816 'DE'"/>
817 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100818</xsl:stylesheet>