blob: 0ac9197d213ac51fa8328704c3dff866fc5a31c3 [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"/>
Nicolas Arnold8f5a96b2025-01-15 19:26:42 +010011 <!--xsl:variable name="debug" select="true()"/-->
Marc Kupietz7f3fe792024-07-26 15:28:26 +020012
Marc Kupietz1a422662024-03-16 09:34:10 +010013 <xsl:variable name="ev"/>
14 <xsl:variable name="x"/>
Harald Luengen017ab122025-01-15 15:40:33 +010015
16 <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010017
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020018 <xsl:variable name="idno_type">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020019 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +010020 <xsl:when test="starts-with($idno, '1')">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020021 <xsl:value-of select="'IDN'"/>
22 </xsl:when>
23 <xsl:otherwise>
24 <xsl:value-of select="'ISBN'"/>
25 </xsl:otherwise>
26 </xsl:choose>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020027 </xsl:variable>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020028
Marc Kupietz1c3ebca2024-09-22 13:49:28 +020029 <xsl:param name="buchpreis"/>
Harald Luengen017ab122025-01-15 15:40:33 +010030
Marc Kupietz0df2a572024-05-26 16:54:27 +020031 <xsl:variable name="dnbBookdataQuery" as="xs:string">
Harald Luengen017ab122025-01-15 15:40:33 +010032 <xsl:value-of disable-output-escaping="yes"
33 select="concat('https://services.dnb.de/sru/dnb?version=1.1&amp;operation=searchRetrieve&amp;query=', $idno_type, '%3D', $idno, '&amp;recordSchema=oai_dc')"/>
Nicolas Arnold8f5a96b2025-01-15 19:26:42 +010034<!--
35 <xsl:if test="$debug">
36 <xsl:message select="concat('debug: Printing idno, just in case ', $idno)"/>
37 </xsl:if>
38 <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')"/>
39>>>>>>> Stashed changes
40-->
Marc Kupietz0df2a572024-05-26 16:54:27 +020041 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010042 <xsl:variable name="dnbBookdata">
Harald Luengen017ab122025-01-15 15:40:33 +010043 <xsl:if test="$debug">
44 <xsl:message select="concat('debug message dnbBookdataQuery: ', $dnbBookdataQuery)"/>
45 <xsl:message select="concat('debug message idno: ', $idno)"/>
46 <xsl:message select="
47 concat('debug message original title from static metadata: ', if (starts-with($idno, '8')) then
48 doc('static_metadata.xml')//oai:dc[dc:identifier = $idno]//dc:title
49 else
50 '')"/>
51 </xsl:if>
52 <xsl:variable name="tmp" select="
53 if (starts-with($idno, '8')) then
54 doc('static_metadata.xml')//oai:dc[dc:identifier = $idno]
55 else
56 doc($dnbBookdataQuery)"/>
57 <xsl:copy-of select="
58 if ($tmp//dc:title) then
59 $tmp
60 else
61 doc('static_metadata.xml')//oai:dc[replace(dc:identifier[@xsi:type = 'tel:ISBN'][1], '-', '') = $idno]"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010062 </xsl:variable>
63
Harald Luengen017ab122025-01-15 15:40:33 +010064 <xsl:variable name="autor" select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
65 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
66 <xsl:variable name="translator" select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
67 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010068
Harald Luengen017ab122025-01-15 15:40:33 +010069 <xsl:variable name="herausgeber" select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
70 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010071
72 <xsl:variable name="ina"/>
73 <xsl:variable name="_corpus"/>
74 <xsl:variable name="ent_known"/>
75
76
77 <!-- added HLU 2012-02-09: -->
78 <xsl:variable name="ent">
79 <xsl:choose>
80 <xsl:when test="$ent_known">
81 <xsl:value-of select="$ent_known"/>
82 </xsl:when>
83 <xsl:when test="$ev">
84 <xsl:value-of select="$ev"/>
85 </xsl:when>
86 <xsl:otherwise>
87 <xsl:value-of select="$j"/>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:variable>
91
92 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020093 <xsl:variable name="title-with-subtitles">
Harald Luengen017ab122025-01-15 15:40:33 +010094 <xsl:if test="$debug">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +020095 <xsl:message select="concat('title: ', ($dnbBookdata//dc:title)[1])"/>
96 </xsl:if>
Marc Kupietz49124fa2024-04-10 16:50:01 +020097 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +010098 <xsl:when test="contains(($dnbBookdata//dc:title)[1], ':')">
Marc Kupietz744d30e2024-09-22 12:49:45 +020099 <xsl:choose>
100 <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')">
101 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/>
102 </xsl:when>
103 <xsl:otherwise>
104 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
105 </xsl:otherwise>
106 </xsl:choose>
Marc Kupietz49124fa2024-04-10 16:50:01 +0200107 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100108 <xsl:when test="contains(($dnbBookdata//dc:title)[1], '/')">
Marc Kupietz6cb52232024-04-13 12:28:44 +0200109 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100110 </xsl:when>
Marc Kupietzb9903542024-09-30 14:02:18 +0200111 <xsl:otherwise>
112 <xsl:value-of select="normalize-space(($dnbBookdata//dc:title)[1])"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +0200113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:variable>
116 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100117 </xsl:variable>
118
119 <xsl:variable name="erscheinungsort">
120 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200121 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
122 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100123 </xsl:when>
124 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200125 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:variable>
129
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200130 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
131
Marc Kupietz6cb52232024-04-13 12:28:44 +0200132 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100133
Harald Luengen017ab122025-01-15 15:40:33 +0100134 <xsl:variable name="genretable">
135 <genres>
136 <genre keyRegex="true.*crime" genre="Roman: True Crime"/>
137 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
138 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
139 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
140 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
141 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
142 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
143 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
144 <genre keyRegex="western" genre="Roman: Westernroman"/>
145 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
146 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
147 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
148 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
149 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
150 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
151 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
152 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
153 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/>
154 <!-- wie in KJL -->
155 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
156 <genre keyRegex="erzählung" genre="Erzählung"/>
157 <genre keyRegex="novelle" genre="Novelle"/>
158 <genre keyRegex="anthologie" genre="Anthologie"/>
159 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
160 <genre keyRegex="geschichte" genre="Erzählung"/>
161 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
162 <genre keyRegex="roman" genre="Roman"/>
163 <genre keyRegex="." genre="Roman"/>
164 </genres>
165 </xsl:variable>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200166
Harald Luengen017ab122025-01-15 15:40:33 +0100167 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100168 <xsl:variable name="verlag">
169 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200170 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
171 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100172 </xsl:when>
173 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200174 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100175 </xsl:otherwise>
176 </xsl:choose>
177 </xsl:variable>
178
179 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200180 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100181 </xsl:variable>
182
Harald Luengen017ab122025-01-15 15:40:33 +0100183 <xsl:variable name="untertitel" select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100184
Marc Kupietza5d01182024-04-14 12:24:02 +0200185 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100186
187 <!-- for BOT+s: -->
Harald Luengen017ab122025-01-15 15:40:33 +0100188 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format, 'S\.', '')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100189
190 <!-- fuer BOT+b: -->
191 <xsl:variable name="_b">
192 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
193 <xsl:choose>
194 <xsl:when test="matches($dnbBookdata, $regexp1)">
195 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
196 <xsl:matching-substring>
197 <xsl:value-of select="."/>
198 </xsl:matching-substring>
199 </xsl:analyze-string>
200 </xsl:when>
201 <xsl:otherwise>
202 <xsl:value-of select="'.'"/>
203 </xsl:otherwise>
204 </xsl:choose>
205 </xsl:variable>
206
207 <!-- for BOT+x: -->
208 <xsl:variable name="txtart">
209 <xsl:choose>
210 <xsl:when test="$x">
211 <xsl:value-of select="concat('[', $x, ']')"/>
212 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100213 <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 +0100214 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200215 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 +0100216 />
Marc Kupietz1a422662024-03-16 09:34:10 +0100217 </xsl:when>
218 <xsl:otherwise>
219 <xsl:value-of>Roman</xsl:value-of>
220 </xsl:otherwise>
221 </xsl:choose>
222 </xsl:variable>
223
224
225
226 <!-- fuer BOTd: -->
Harald Luengen017ab122025-01-15 15:40:33 +0100227 <xsl:variable name="dok" select="
228 concat((if (string-length($autor) &gt; 0) then
229 concat($straight_autor, ': ')
230 else
231 ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100232
233 <!-- END variables derived from sru request to dnb archive -->
234
235
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200236 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100237
238 <!-- for BOTD: -->
239 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
240 <xsl:variable name="doc_sigle">
241 <xsl:variable name="firstContentWordTitleInitial">
242 <xsl:variable name="helper">
243 <xsl:analyze-string select="$titel" regex="\w+">
244 <xsl:matching-substring>
245 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100246 <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 +0100247 <!-- TODO: Fktnswoerter nachtragen -->
248 <xsl:sequence select="."/>
249 </xsl:when>
250 <xsl:otherwise/>
251 </xsl:choose>
252 </xsl:matching-substring>
253 </xsl:analyze-string>
254 </xsl:variable>
Harald Luengen017ab122025-01-15 15:40:33 +0100255 <xsl:value-of select="upper-case(substring(normalize-space(replace($helper, '\s+.+$', '')), 1, 3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100256 <!-- longest match of .+ -->
257 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200258 <xsl:variable name="authorInitials">
259 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100260 <xsl:when test="contains($autor, ';')">
261 <xsl:variable name="lastname_aut1" select="upper-case(substring(normalize-space($autor), 1, 1))"/>
262 <xsl:variable name="lastname_aut2" select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
263 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200264 </xsl:when>
265 <xsl:otherwise>
Harald Luengen017ab122025-01-15 15:40:33 +0100266 <xsl:variable name="lastname_aut1" select="upper-case(substring(normalize-space(substring-before($autor, ',')), 1, 1))"/>
267 <xsl:variable name="firstname_aut1" select="upper-case(substring(normalize-space(substring-after($autor, ',')), 1, 1))"/>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200268 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
269 </xsl:otherwise>
270 </xsl:choose>
271 </xsl:variable>
Harald Luengen017ab122025-01-15 15:40:33 +0100272 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials, $firstContentWordTitleInitial), 'NFKD'), '[^A-Z]', ''), 1, 3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100273 </xsl:variable>
274
275
Marc Kupietz0c246632024-04-29 07:08:23 +0200276 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100277 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
278
279 <!-- fuer BOT+xy: (?) -->
280 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200281 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100282 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200283 <xsl:text>IDNO:</xsl:text>
284 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100285 <xsl:text>; </xsl:text>
286 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
287 </xsl:variable>
288
Harald Luengen017ab122025-01-15 15:40:33 +0100289 <xsl:variable name="long-reference" select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100290
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100291 <!-- NA -->
Harald Luengen017ab122025-01-15 15:40:33 +0100292 <xsl:variable name="bot_title" select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100293 <!-- end NA -->
294
Harald Luengen017ab122025-01-15 15:40:33 +0100295 <xsl:variable name="short-reference" select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100296
Nicolas Arnold8f5a96b2025-01-15 19:26:42 +0100297 <xsl:variable name="dtitle" select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100298
Marc Kupietz1a422662024-03-16 09:34:10 +0100299 <xsl:template match="/">
Nicolas Arnold80388962025-01-15 19:35:09 +0100300 <!-- for debugging purposes
Marc Kupietz98645242024-05-26 16:52:47 +0200301 <xsl:message select="concat('uri: ', base-uri())"/>
302 <xsl:message select="concat('idno: ', $idno)"/>
303
304 <xsl:message>
305 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
306 </xsl:message>
307
308 <xsl:message>
309 <xsl:copy-of select="$dnbBookdata"/>
310 </xsl:message>
Nicolas Arnold80388962025-01-15 19:35:09 +0100311 <!- -->
Harald Luengen017ab122025-01-15 15:40:33 +0100312
313 <xsl:if test="not($dnbBookdata//oai:dc)">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +0200314 <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 +0100315 <xsl:text>&#10;Query was: </xsl:text>
316 <xsl:value-of disable-output-escaping="yes" select="replace($dnbBookdataQuery, '&amp;', '%38')"/>
317 <xsl:text>&#10;Retrieved response: </xsl:text>
318 <xsl:copy-of select="$dnbBookdata"/>
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +0200319 </xsl:message>
320 </xsl:if>
321
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200322 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200323 <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 +0200324 </xsl:if>
325
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200326 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200327 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200328 </xsl:if>
329
Marc Kupietz2badfb12024-04-19 12:59:40 +0200330 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200331 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200332 </xsl:if>
333
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200334 <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 +0200335 <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 +0200336 </xsl:if>
337
Marc Kupietz1a422662024-03-16 09:34:10 +0100338 <idsDoc TEIform="TEI.2" type="text" version="1.0">
339 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
340 <fileDesc>
341 <titleStmt>
Harald Luengen017ab122025-01-15 15:40:33 +0100342 <dokumentSigle>
343 <xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/>
344 </dokumentSigle>
345 <d.title>
Nicolas Arnold8f5a96b2025-01-15 19:26:42 +0100346 <!-- NA: use separate dtitle variable, to have independent control over $short-reference -->
347 <xsl:value-of select="$dtitle"/>
348 <!-- END NA -->
Harald Luengen017ab122025-01-15 15:40:33 +0100349 </d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100350 </titleStmt>
351 <publicationStmt>
352 <distributor/>
353 <pubAddress/>
354 <availability region="world" status="unknown">QAO-NC</availability>
355 <pubDate/>
356 </publicationStmt>
357 <sourceDesc>
358 <biblStruct>
359 <monogr>
360 <h.title type="main"/>
361 <imprint/>
362 </monogr>
363 </biblStruct>
364 </sourceDesc>
365 </fileDesc>
366 </idsHeader>
367 <idsText version="1.0">
368 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
369 <fileDesc>
370 <titleStmt>
Harald Luengen017ab122025-01-15 15:40:33 +0100371 <textSigle>
372 <xsl:sequence select="$sigle"/>
373 </textSigle>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100374 <!-- NA -->
Harald Luengen017ab122025-01-15 15:40:33 +0100375 <t.title assemblage="regular">
376 <xsl:value-of select="$bot_title"/>
377 </t.title>
Nicolas Arnoldf84fcec2025-01-15 11:57:55 +0100378 <!-- end NA -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100379 </titleStmt>
380 <publicationStmt>
381 <distributor/>
382 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200383 <xsl:for-each select="$dnbBookdata//dc:identifier">
384 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
385 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100386 <xsl:when test="@xsi:type = 'tel:ISBN'">
387 <xsl:if test="matches(., '(^([0-9]|-)+X?).*')">
388 <idno type="{$type}">
389 <xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/>
390 </idno>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200391 </xsl:if>
392 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100393 <xsl:when test="$type = 'URL' and contains(., '/urn:nbn:de')">
394 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL">
395 <xsl:value-of select="."/>
396 </idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200397 </xsl:when>
Harald Luengen017ab122025-01-15 15:40:33 +0100398 <xsl:otherwise>
399 <idno type="{$type}">
400 <xsl:value-of select="."/>
401 </idno>
402 </xsl:otherwise>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200403 </xsl:choose>
404 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100405 <availability region="world" status="unknown">QAO-NC</availability>
406 <pubDate/>
407 </publicationStmt>
408 <sourceDesc>
409 <biblStruct>
410 <monogr>
Harald Luengen017ab122025-01-15 15:40:33 +0100411 <h.title type="main">
412 <xsl:value-of select="$titel"/>
413 </h.title>
414 <h.title type="sub">
415 <xsl:value-of select="$untertitel"/>
416 </h.title>
417 <h.author>
418 <xsl:value-of select="$autor"/>
419 </h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200420 <xsl:if test="$translator">
Harald Luengen017ab122025-01-15 15:40:33 +0100421 <editor role="translator">
422 <xsl:value-of select="$translator"/>
423 </editor>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200424 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200425 <xsl:if test="$herausgeber">
Harald Luengen017ab122025-01-15 15:40:33 +0100426 <editor role="editor">
427 <xsl:value-of select="$herausgeber"/>
428 </editor>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200429 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100430 <edition>
431 <further/>
432 <kind>E-Book-Ausgabe</kind>
433 <appearance>EPUB-Datei</appearance>
434 </edition>
435 <imprint>
Harald Luengen017ab122025-01-15 15:40:33 +0100436 <publisher>
437 <xsl:value-of select="$verlag"/>
438 </publisher>
439 <pubDate type="year">
440 <xsl:value-of select="$j"/>
441 </pubDate>
Marc Kupietz1a422662024-03-16 09:34:10 +0100442 <pubDate type="month"/>
443 <pubDate type="day"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100444 <pubPlace key="{$erscheinungsland}">
445 <xsl:value-of select="$erscheinungsort"/>
446 </pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100447 </imprint>
448 <biblScope type="subsume"/>
449 <biblScope type="pp"/>
450 <biblScope type="vol"/>
451 <biblScope type="volume-title"/>
452 </monogr>
Marc Kupietz1c3ebca2024-09-22 13:49:28 +0200453 <xsl:if test="$buchpreis">
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200454 <xsl:element name="note">
455 <xsl:attribute name="type">award</xsl:attribute>
456 <xsl:attribute name="subtype">
Marc Kupietze43c7202024-09-22 12:53:41 +0200457 <xsl:value-of select="'Buchpreis deutscher_buchpreis'"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200458 </xsl:attribute>
459 </xsl:element>
460 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100461 </biblStruct>
Harald Luengen017ab122025-01-15 15:40:33 +0100462 <!-- NA -->
463 <reference assemblage="regular" type="complete">
464 <xsl:value-of select="$long-reference"/>
465 </reference>
466 <reference assemblage="regular" type="short">
467 <xsl:value-of select="$short-reference"/>
468 </reference>
469 <!-- END NA -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100470 </sourceDesc>
471 </fileDesc>
472 <profileDesc>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100473 <!-- outcommented HL -->
474 <!--creation>
Marc Kupietz1a422662024-03-16 09:34:10 +0100475 <creatDate><xsl:value-of select="$j"/></creatDate>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100476 </creation-->
477 <!-- BEGIN HL -->
478 <xsl:call-template name="creation_temp">
479 <xsl:with-param name="j" select="$j"/>
480 </xsl:call-template>
481 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100482 <textClass/>
483 <textDesc>
Harald Luengen017ab122025-01-15 15:40:33 +0100484 <textType>
485 <xsl:value-of select="$textFullGenre"/>
486 </textType>
487 <textTypeRef>
488 <xsl:value-of select="replace($textFullGenre, '.*: *', '')"/>
489 </textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100490 <textDomain/>
491 </textDesc>
492 </profileDesc>
493 </idsHeader>
494 <text>
Harald Luengen017ab122025-01-15 15:40:33 +0100495 <body>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200496 <!-- Call the template for each idref the spine -->
497 <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100498 </body>
499 </text>
500 </idsText>
501 </idsDoc>
502 </xsl:template>
Harald Luengen017ab122025-01-15 15:40:33 +0100503
Harald Luengenb81b63b2025-01-09 15:44:14 +0100504 <!-- BEGIN HL -->
505 <xsl:template name="creation_temp">
506 <xsl:param name="j"/>
507 <creation>
Harald Luengen017ab122025-01-15 15:40:33 +0100508 <creatDate>
509 <xsl:value-of select="$j"/>
510 </creatDate>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100511 </creation>
512 </xsl:template>
513 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100514
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200515 <xsl:template match="opf:itemref" mode="collect">
516 <xsl:variable name="id" select="@idref"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100517 <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 +0200518
519 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100520 <xsl:when test="$item">
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200521 <xsl:variable name="href" select="$item/@href"/>
522 <xsl:if test="$debug">
523 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100524 <xsl:text>converting: </xsl:text>
525 <xsl:value-of select="$id"/>
526 <xsl:text> </xsl:text>
527 <xsl:value-of select="$href"/>
528 <xsl:text> </xsl:text>
529 <xsl:value-of select="$idno"/>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200530 </xsl:message>
531 </xsl:if>
532 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
533 </xsl:when>
534 <xsl:otherwise>
535 <xsl:if test="$debug">
536 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100537 <xsl:text>skipping: </xsl:text>
538 <xsl:value-of select="$id"/>
539 <xsl:text> </xsl:text>
540 <xsl:value-of select="$idno"/>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200541 </xsl:message>
542 </xsl:if>
543 </xsl:otherwise>
544 </xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100545 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100546
547 <xsl:template match="xhtml:body">
548 <div type="chapter">
549 <xsl:apply-templates/>
550 </div>
551 </xsl:template>
552
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000553 <xsl:template match="xhtml:body/text()">
554 <p>
555 <xsl:value-of select="."/>
556 </p>
557 </xsl:template>
558
Marc Kupietz1a422662024-03-16 09:34:10 +0100559 <xsl:template match="xhtml:title">
560 <head>
561 <xsl:apply-templates/>
562 </head>
563 </xsl:template>
564
565 <xsl:template match="xhtml:h1">
566 <head>
567 <xsl:apply-templates/>
568 </head>
569 </xsl:template>
570
Harald Luengen017ab122025-01-15 15:40:33 +0100571 <xsl:template match="xhtml:h2 | xhtml:h3 | xhtml:h4 | xhtml:h5 | xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100572 <head type="sub">
573 <xsl:apply-templates/>
574 </head>
575 </xsl:template>
576
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100577 <xsl:template match="xhtml:em">
578 <emph>
579 <xsl:apply-templates/>
580 </emph>
581 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100582
Marc Kupietz30cc0802024-04-10 16:37:04 +0200583 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
584 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
585 <hi rend="{$class}">
586 <xsl:apply-templates/>
587 </hi>
588 </xsl:template>
589
Marc Kupietzad4d4462024-04-26 17:43:08 +0200590 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200591 <xsl:apply-templates/>
592 </xsl:template>
593
Harald Luengen017ab122025-01-15 15:40:33 +0100594 <xsl:template match="xhtml:b | xhtml:span[@class = 'b'] | xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200595 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100596 <xsl:apply-templates/>
597 </hi>
598 </xsl:template>
599
Harald Luengen017ab122025-01-15 15:40:33 +0100600 <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 +0000601 <hi rend="italic">
602 <xsl:apply-templates/>
603 </hi>
604 </xsl:template>
605
606
Harald Luengen017ab122025-01-15 15:40:33 +0100607 <xsl:template match="xhtml:sub | xhtml:span[@class = 'sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100608 <hi rend="sub">
609 <xsl:apply-templates/>
610 </hi>
611 </xsl:template>
612
Harald Luengen017ab122025-01-15 15:40:33 +0100613 <xsl:template match="xhtml:sup | xhtml:span[@class = 'sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100614 <hi rend="sup">
615 <xsl:apply-templates/>
616 </hi>
617 </xsl:template>
618
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000619 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100620
Harald Luengen017ab122025-01-15 15:40:33 +0100621 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1 | ./xhtml:h2 | ./xhtml:h3]" priority="1.0">
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200622 <xsl:apply-templates/>
623 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000624 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100625 <p>
626 <xsl:apply-templates/>
627 </p>
628 </xsl:template>
629
Harald Luengen017ab122025-01-15 15:40:33 +0100630 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p | descendant::xhtml:div)]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000631 <div type="section">
632 <xsl:apply-templates/>
633 </div>
634 </xsl:template>
635
Harald Luengen017ab122025-01-15 15:40:33 +0100636 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p | descendant::xhtml:div)]">
637 <div type="section">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000638 <p>
639 <xsl:apply-templates/>
640 </p>
641 </div>
642 </xsl:template>
643
Harald Luengen017ab122025-01-15 15:40:33 +0100644 <xsl:template match="xhtml:p[not(descendant::xhtml:p | descendant::xhtml:div)]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000645 <xsl:if test="normalize-space(.)">
646 <p>
647 <xsl:apply-templates/>
648 </p>
649 </xsl:if>
650 </xsl:template>
651
Harald Luengen017ab122025-01-15 15:40:33 +0100652 <xsl:template match="xhtml:p[descendant::xhtml:p | descendant::xhtml:div]">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000653 <xsl:if test="normalize-space(.)">
654 <div type="section">
655 <xsl:apply-templates/>
656 </div>
657 </xsl:if>
658 </xsl:template>
659
Marc Kupietz09745e12024-04-21 12:54:10 +0200660 <xsl:template match="xhtml:ul">
661 <list type="unordered">
662 <xsl:apply-templates/>
663 </list>
664 </xsl:template>
665 <xsl:template match="xhtml:ol">
666 <list type="ordered">
667 <xsl:apply-templates/>
668 </list>
669 </xsl:template>
670 <xsl:template match="xhtml:li">
671 <item>
672 <xsl:apply-templates/>
Harald Luengen017ab122025-01-15 15:40:33 +0100673 </item>
Marc Kupietz09745e12024-04-21 12:54:10 +0200674 </xsl:template>
675 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200676 <!-- <gap reason="toc"/> -->
677 </xsl:template>
678
Marc Kupietz1a422662024-03-16 09:34:10 +0100679 <xsl:template match="xhtml:img">
680 <!-- <gap reason="image"/> -->
681 </xsl:template>
682
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200683 <xsl:template match="xhtml:audio">
684 <!-- <gap reason="audio"/> -->
685 </xsl:template>
686
Marc Kupietz09745e12024-04-21 12:54:10 +0200687 <xsl:template match="xhtml:table">
688 <!-- <gap reason="table"/> -->
689 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000690 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200691 <xsl:if test="normalize-space(.)">
692 <p>
693 <ref target="{@href}">
Harald Luengen017ab122025-01-15 15:40:33 +0100694 <xsl:apply-templates/>
Marc Kupietz164a2832024-04-14 21:00:48 +0200695 </ref>
696 </p>
697 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000698 </xsl:template>
699
Harald Luengen017ab122025-01-15 15:40:33 +0100700 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200701 <xsl:if test="$debug">
Harald Luengen017ab122025-01-15 15:40:33 +0100702 <xsl:message>
703 <xsl:text>unhandled span element: </xsl:text>
704 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200705 </xsl:message>
706 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000707 <div type="section">
708 <p>
Harald Luengen017ab122025-01-15 15:40:33 +0100709 <xsl:value-of select="."/>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000710 </p>
711 </div>
712 </xsl:template>
713 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200714 <xsl:if test="$debug">
715 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100716 <xsl:text>unhandled span element: </xsl:text>
717 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200718 </xsl:message>
719 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000720 <xsl:value-of select="."/>
721 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100722 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200723 <xsl:if test="normalize-space(.)">
724 <ref target="{@href}">
Harald Luengen017ab122025-01-15 15:40:33 +0100725 <xsl:apply-templates/>
Marc Kupietz164a2832024-04-14 21:00:48 +0200726 </ref>
727 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100728 </xsl:template>
729
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200730 <xsl:template match="xhtml:br">
Harald Luengen017ab122025-01-15 15:40:33 +0100731 <lb/>
732 <xsl:text>&#10;</xsl:text>
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200733 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100734
Marc Kupietz1a422662024-03-16 09:34:10 +0100735 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200736 <xsl:if test="$debug">
737 <xsl:message>
Harald Luengen017ab122025-01-15 15:40:33 +0100738 <xsl:text>unhandled element: </xsl:text>
739 <xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200740 </xsl:message>
741 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000742 <xsl:choose>
Harald Luengen017ab122025-01-15 15:40:33 +0100743 <xsl:when test="descendant::xhtml:div | descendant::xhtml:p | parent::xhtml:body">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000744 <div type="section">
745 <xsl:apply-templates/>
746 </div>
747 </xsl:when>
748 <xsl:otherwise>
Harald Luengen017ab122025-01-15 15:40:33 +0100749 <xsl:apply-templates select="./* | node()"/>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000750 </xsl:otherwise>
751 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100752 <xsl:apply-templates/>
753 </xsl:template>
754
755 <xsl:function name="ids:reversedAuthors">
Harald Luengen017ab122025-01-15 15:40:33 +0100756 <xsl:param name="s"/>
757 <xsl:value-of select="
Marc Kupietz1a422662024-03-16 09:34:10 +0100758 if (matches($s, ';')) then
759 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
760 else
Harald Luengen017ab122025-01-15 15:40:33 +0100761 replace($s, '(.+) (.+)', '$2, $1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100762 </xsl:function>
763
764 <xsl:function name="hlu:reversedAuthors">
765 <xsl:param name="s"/>
Harald Luengen017ab122025-01-15 15:40:33 +0100766 <xsl:value-of select="
767 if (matches($s, ';')) then
768 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
769 else
770 replace($s, '(.+),(.+)', '$2, $1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100771 </xsl:function>
772
Harald Luengen017ab122025-01-15 15:40:33 +0100773 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
774 <xsl:map>
775 <xsl:map-entry key="'Axams'" select="'AT'"/>
776 <xsl:map-entry key="'Vienna'" select="'AT'"/>
777 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
778 <xsl:map-entry key="'Graz'" select="'AT'"/>
779 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
780 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
781 <xsl:map-entry key="'Bern'" select="'CH'"/>
782 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
783 <xsl:map-entry key="'Zurich'" select="'CH'"/>
784 <xsl:map-entry key="'Basel'" select="'CH'"/>
785 <xsl:map-entry key="'Geneva'" select="'CH'"/>
786 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
787 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
788 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
789 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
790 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
791 <xsl:map-entry key="'Brussels'" select="'BE'"/>
792 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
793 <xsl:map-entry key="'Ghent'" select="'BE'"/>
794 <xsl:map-entry key="'Bruges'" select="'BE'"/>
795 <xsl:map-entry key="'Leuven'" select="'BE'"/>
796 <xsl:map-entry key="'Liege'" select="'BE'"/>
797 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
798 <xsl:map-entry key="'Namur'" select="'BE'"/>
799 <xsl:map-entry key="'Mons'" select="'BE'"/>
800 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
801 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
802 <xsl:map-entry key="'colatina'" select="'BR'"/>
803 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
804 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
805 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
806 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
807 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
808 <xsl:map-entry key="'Victoria'" select="'CA'"/>
809 <xsl:map-entry key="'Wien'" select="'AT'"/>
810 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
811 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
812 <xsl:map-entry key="'Zürich'" select="'CH'"/>
813 <xsl:map-entry key="'Zug'" select="'CH'"/>
814 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
815 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200816
Harald Luengen017ab122025-01-15 15:40:33 +0100817 </xsl:variable>
Marc Kupietz10903f32024-04-14 14:21:18 +0200818
Harald Luengen017ab122025-01-15 15:40:33 +0100819 <!-- Define the function -->
820 <xsl:function name="ids:country-city" as="xs:string">
821 <xsl:param name="city" as="xs:string"/>
822 <xsl:sequence select="
823 if (map:contains($city-country-map, $city)) then
824 map:get($city-country-map, $city)
825 else
826 'DE'"/>
827 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100828</xsl:stylesheet>