blob: 1917b6dc6063565a7ccc6c683bd51334b56ab934 [file] [log] [blame]
Marc Kupietz1a422662024-03-16 09:34:10 +01001<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:xs="http://www.w3.org/2001/XMLSchema"
3 xmlns:opf="http://www.idpf.org/2007/opf"
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 xmlns:ids="http://www.ids-mannheim.de/ids"
6 xmlns:hlu="http://www.ids-mannheim.de/hlu"
7 xmlns:saxon="http://saxon.sf.net/"
8 xmlns:xhtml="http://www.w3.org/1999/xhtml"
9 exclude-result-prefixes="xs opf dc ids hlu saxon xhtml">
10
11 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" saxon:line-length="1000"/>
12 <xsl:strip-space elements="*"/>
13
14 <xsl:variable name="ev"/>
15 <xsl:variable name="x"/>
16
17 <xsl:variable name="isbn" as="xs:string" select="replace(document-uri(), '.*([0-9]{13,}).*' , '$1')"/>
18
19
20 <xsl:variable name="dnbBookdata">
21 <xsl:copy-of select="doc(concat('https://services.dnb.de/sru/dnb?version=1.1&amp;operation=searchRetrieve&amp;query=NUM%3D', $isbn, '&amp;recordSchema=oai_dc'))"/>
22 </xsl:variable>
23
24 <xsl:variable name="autor"
Marc Kupietzea387372024-04-10 16:34:57 +020025 select="replace(string-join($dnbBookdata//dc:creator[not(matches(., '\[(Erzähler)\]'))], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010026
Marc Kupietzb660ed62024-03-16 11:45:53 +010027 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010028
29 <xsl:variable name="ina"/>
30 <xsl:variable name="_corpus"/>
31 <xsl:variable name="ent_known"/>
32
33
34 <!-- added HLU 2012-02-09: -->
35 <xsl:variable name="ent">
36 <xsl:choose>
37 <xsl:when test="$ent_known">
38 <xsl:value-of select="$ent_known"/>
39 </xsl:when>
40 <xsl:when test="$ev">
41 <xsl:value-of select="$ev"/>
42 </xsl:when>
43 <xsl:otherwise>
44 <xsl:value-of select="$j"/>
45 </xsl:otherwise>
46 </xsl:choose>
47 </xsl:variable>
48
49 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020050 <xsl:variable name="title-with-subtitles">
51 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020052 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
53 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"
Marc Kupietz49124fa2024-04-10 16:50:01 +020054 />
55 </xsl:when>
56 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020057 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020058 </xsl:otherwise>
59 </xsl:choose>
60 </xsl:variable>
61 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010062 </xsl:variable>
63
64 <xsl:variable name="erscheinungsort">
65 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020066 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
67 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010068 </xsl:when>
69 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020070 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010071 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:variable>
74
Marc Kupietzd8599fc2024-04-14 13:16:56 +020075 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
76
Marc Kupietz6cb52232024-04-13 12:28:44 +020077 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +010078
Marc Kupietz1a422662024-03-16 09:34:10 +010079 <xsl:variable name="verlag">
80 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020081 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
82 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010083 </xsl:when>
84 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020085 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010086 </xsl:otherwise>
87 </xsl:choose>
88 </xsl:variable>
89
90 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +020091 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010092 </xsl:variable>
93
94 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +020095 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010096
97 <xsl:variable name="herausgeber">
98 <xsl:choose>
99 <xsl:when test="$dnbBookdata//dc:creator[ends-with(.,'[Hrsg.]')]">
100 <xsl:value-of
Marc Kupietz6cb52232024-04-13 12:28:44 +0200101 select="replace(string-join($dnbBookdata//dc:creator[ends-with(.,'[Hrsg.]')][1], ' ; '),'\s?\[Hrsg.\]','')"
Marc Kupietz1a422662024-03-16 09:34:10 +0100102 />
103 </xsl:when>
104 <xsl:otherwise>.</xsl:otherwise>
105 </xsl:choose>
106 </xsl:variable>
107
108 <xsl:variable name="straight_herausgeber"
109 select="replace(hlu:reversedAuthors($herausgeber), ',', '')"/>
110
Marc Kupietza5d01182024-04-14 12:24:02 +0200111 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100112
113 <!-- for BOT+s: -->
114 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
115
116 <!-- fuer BOT+b: -->
117 <xsl:variable name="_b">
118 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
119 <xsl:choose>
120 <xsl:when test="matches($dnbBookdata, $regexp1)">
121 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
122 <xsl:matching-substring>
123 <xsl:value-of select="."/>
124 </xsl:matching-substring>
125 </xsl:analyze-string>
126 </xsl:when>
127 <xsl:otherwise>
128 <xsl:value-of select="'.'"/>
129 </xsl:otherwise>
130 </xsl:choose>
131 </xsl:variable>
132
133 <!-- for BOT+x: -->
134 <xsl:variable name="txtart">
135 <xsl:choose>
136 <xsl:when test="$x">
137 <xsl:value-of select="concat('[', $x, ']')"/>
138 </xsl:when>
139 <xsl:when
140 test="matches($untertitel, '([Rr]oman|[Ee]rzhlung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
141 <xsl:value-of
142 select="concat('[', replace(replace($untertitel, '.*?(((^|\P{L})\p{L}+)?([Rr]oman|[Ee]rzhlung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)).*', '$1'), '\P{L}*(.+)', '$1'), ']')"
143 />
144 </xsl:when>
145 <xsl:otherwise>
146 <xsl:value-of>Roman</xsl:value-of>
147 </xsl:otherwise>
148 </xsl:choose>
149 </xsl:variable>
150
151
152
153 <!-- fuer BOTd: -->
154 <xsl:variable name="dok"
155 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
156
157 <!-- END variables derived from sru request to dnb archive -->
158
159
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200160 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100161
162 <!-- for BOTD: -->
163 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
164 <xsl:variable name="doc_sigle">
165 <xsl:variable name="firstContentWordTitleInitial">
166 <xsl:variable name="helper">
167 <xsl:analyze-string select="$titel" regex="\w+">
168 <xsl:matching-substring>
169 <xsl:choose>
170 <xsl:when
171 test="matches(.,'^[A-Z]') and not(matches(.,'^(Der|Die|Das|Des|Ein|Eine|Eines|Einmal|Von|Mit|Zu|Zurck)$'))">
172 <!-- TODO: Fktnswoerter nachtragen -->
173 <xsl:sequence select="."/>
174 </xsl:when>
175 <xsl:otherwise/>
176 </xsl:choose>
177 </xsl:matching-substring>
178 </xsl:analyze-string>
179 </xsl:variable>
180 <xsl:value-of
181 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,1))"/>
182 <!-- longest match of .+ -->
183 </xsl:variable>
184 <xsl:choose>
185 <xsl:when test="contains($autor,';')">
186 <xsl:variable name="lastname_aut1"
187 select="upper-case(substring(normalize-space(substring-before(substring-before($autor,';'),',')), 1, 1))"/>
188 <xsl:variable name="lastname_aut2"
189 select="upper-case(substring(normalize-space(substring-before(substring-before(substring-after($autor, ';'),';'),',')), 1, 1))"/>
190 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:variable name="lastname_aut1"
194 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
195 <xsl:variable name="firstname_aut1"
196 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
197 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
198 </xsl:otherwise>
199 </xsl:choose>
200 <xsl:value-of select="$firstContentWordTitleInitial"/>
201 </xsl:variable>
202
203
204 <xsl:variable name="text_sigle" select="substring($isbn, 8, 5)"/>
205 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
206
207 <!-- fuer BOT+xy: (?) -->
208 <xsl:variable name="xyref">
209 <xsl:value-of select="document-uri(.)"/>
210 <xsl:text>; </xsl:text>
211 <xsl:text>ISBN:</xsl:text>
212 <xsl:value-of select="$isbn"/>
213 <xsl:text>; </xsl:text>
214 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
215 </xsl:variable>
216
Marc Kupietzb660ed62024-03-16 11:45:53 +0100217 <xsl:variable name="long-reference"
218 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
219
220 <xsl:variable name="short-reference"
221 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100222
223 <xsl:template match="/">
224 <idsDoc TEIform="TEI.2" type="text" version="1.0">
225 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
226 <fileDesc>
227 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100228 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
229 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100230 </titleStmt>
231 <publicationStmt>
232 <distributor/>
233 <pubAddress/>
234 <availability region="world" status="unknown">QAO-NC</availability>
235 <pubDate/>
236 </publicationStmt>
237 <sourceDesc>
238 <biblStruct>
239 <monogr>
240 <h.title type="main"/>
241 <imprint/>
242 </monogr>
243 </biblStruct>
244 </sourceDesc>
245 </fileDesc>
246 </idsHeader>
247 <idsText version="1.0">
248 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
249 <fileDesc>
250 <titleStmt>
251 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100252 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100253 </titleStmt>
254 <publicationStmt>
255 <distributor/>
256 <pubAddress/>
257 <availability region="world" status="unknown">QAO-NC</availability>
258 <pubDate/>
259 </publicationStmt>
260 <sourceDesc>
261 <biblStruct>
262 <monogr>
263 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
264 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
265 <h.author><xsl:value-of select="$autor"/></h.author>
266 <editor/>
267 <edition>
268 <further/>
269 <kind>E-Book-Ausgabe</kind>
270 <appearance>EPUB-Datei</appearance>
271 </edition>
272 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100273 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100274 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
275 <pubDate type="month"/>
276 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200277 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100278 </imprint>
279 <biblScope type="subsume"/>
280 <biblScope type="pp"/>
281 <biblScope type="vol"/>
282 <biblScope type="volume-title"/>
283 </monogr>
284 </biblStruct>
285 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100286 </sourceDesc>
287 </fileDesc>
288 <profileDesc>
289 <creation>
290 <creatDate><xsl:value-of select="$j"/></creatDate>
291 </creation>
292 <textClass/>
293 <textDesc>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100294 <textType><xsl:value-of select="$texttype"/></textType>
295 <textTypeRef><xsl:value-of select="$texttype"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100296 <textDomain/>
297 </textDesc>
298 </profileDesc>
299 </idsHeader>
300 <text>
301 <body>
302 <!-- Call the template for each link in the TOC
303 <xsl:apply-templates select="//xhtml:ol[@class='toc']/xhtml:li/xhtml:a" mode="collect"/> -->
Marc Kupietz8f727302024-04-10 16:31:19 +0200304 <xsl:apply-templates select="//opf:package/opf:manifest/opf:item[matches(@href, '\.x?html$') and not(matches(@href, '(cover|toc|copyright|feedback|inhalt|nav|titlepage).*'))]" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100305 </body>
306 </text>
307 </idsText>
308 </idsDoc>
309 </xsl:template>
310
311 <xsl:template match="opf:item" mode="collect">
312 <xsl:variable name="href" select="@href"/>
313 <xsl:message>
314 <xsl:text>converting: </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$isbn"/>
315 </xsl:message>
316 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
317 </xsl:template>
318
319 <xsl:template match="xhtml:body">
320 <div type="chapter">
321 <xsl:apply-templates/>
322 </div>
323 </xsl:template>
324
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000325 <xsl:template match="xhtml:body/text()">
326 <p>
327 <xsl:value-of select="."/>
328 </p>
329 </xsl:template>
330
Marc Kupietz1a422662024-03-16 09:34:10 +0100331 <xsl:template match="xhtml:title">
332 <head>
333 <xsl:apply-templates/>
334 </head>
335 </xsl:template>
336
337 <xsl:template match="xhtml:h1">
338 <head>
339 <xsl:apply-templates/>
340 </head>
341 </xsl:template>
342
343 <xsl:template match="xhtml:h2|xhtml:h3">
344 <head type="sub">
345 <xsl:apply-templates/>
346 </head>
347 </xsl:template>
348
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100349 <xsl:template match="xhtml:em">
350 <emph>
351 <xsl:apply-templates/>
352 </emph>
353 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100354
Marc Kupietz30cc0802024-04-10 16:37:04 +0200355 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
356 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
357 <hi rend="{$class}">
358 <xsl:apply-templates/>
359 </hi>
360 </xsl:template>
361
362 <xsl:template match="xhtml:b">
363 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100364 <xsl:apply-templates/>
365 </hi>
366 </xsl:template>
367
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000368 <xsl:template match="xhtml:i">
369 <hi rend="italic">
370 <xsl:apply-templates/>
371 </hi>
372 </xsl:template>
373
374
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100375 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100376 <hi rend="sub">
377 <xsl:apply-templates/>
378 </hi>
379 </xsl:template>
380
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100381 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100382 <hi rend="sup">
383 <xsl:apply-templates/>
384 </hi>
385 </xsl:template>
386
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000387 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100388
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000389 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100390 <p>
391 <xsl:apply-templates/>
392 </p>
393 </xsl:template>
394
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000395 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
396 <div type="section">
397 <xsl:apply-templates/>
398 </div>
399 </xsl:template>
400
401 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
402 <div type="section">
403 <p>
404 <xsl:apply-templates/>
405 </p>
406 </div>
407 </xsl:template>
408
409 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
410 <xsl:if test="normalize-space(.)">
411 <p>
412 <xsl:apply-templates/>
413 </p>
414 </xsl:if>
415 </xsl:template>
416
417 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
418 <xsl:if test="normalize-space(.)">
419 <div type="section">
420 <xsl:apply-templates/>
421 </div>
422 </xsl:if>
423 </xsl:template>
424
425 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200426 <!-- <gap reason="toc"/> -->
427 </xsl:template>
428
Marc Kupietz1a422662024-03-16 09:34:10 +0100429 <xsl:template match="xhtml:img">
430 <!-- <gap reason="image"/> -->
431 </xsl:template>
432
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200433 <xsl:template match="xhtml:audio">
434 <!-- <gap reason="audio"/> -->
435 </xsl:template>
436
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000437 <xsl:template match="xhtml:body/xhtml:a">
438 <p>
439 <ref target="{@href}">
440 <xsl:apply-templates />
441 </ref>
442 </p>
443 </xsl:template>
444
445 <xsl:template match="xhtml:body/xhtml:span">
446 <xsl:message>
447 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
448 </xsl:message>
449 <div type="section">
450 <p>
451 <xsl:value-of select="."/>
452 </p>
453 </div>
454 </xsl:template>
455 <xsl:template match="xhtml:span">
456 <xsl:message>
457 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
458 </xsl:message>
459 <xsl:value-of select="."/>
460 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100461 <xsl:template match="xhtml:a">
462 <ref target="{@href}">
463 <xsl:apply-templates />
464 </ref>
465 </xsl:template>
466
467 <xsl:template match="xhtml:br"/>
468
Marc Kupietz1a422662024-03-16 09:34:10 +0100469 <xsl:template match="xhtml:*">
470 <xsl:message>
471 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
472 </xsl:message>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000473 <xsl:choose>
474 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
475 <div type="section">
476 <xsl:apply-templates/>
477 </div>
478 </xsl:when>
479 <xsl:otherwise>
480 <xsl:apply-templates select="./*|node()"/>
481 </xsl:otherwise>
482 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100483 <xsl:apply-templates/>
484 </xsl:template>
485
486 <xsl:function name="ids:reversedAuthors">
487 <xsl:param name="s" />
488 <xsl:value-of
489 select="
490 if (matches($s, ';')) then
491 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
492 else
493 replace($s, '(.+) (.+)', '$2, $1')"
494 />
495 </xsl:function>
496
497 <xsl:function name="hlu:reversedAuthors">
498 <xsl:param name="s"/>
499 <xsl:value-of
500 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
501 />
502 </xsl:function>
503
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200504 <xsl:variable name="city-country-mapping">
505 <cities>
506 <country city="Axams">AT</country>
507 <country city="Vienna">AT</country>
508 <country city="Klagenfurt">AT</country>
509 <country city="Graz">AT</country>
510 <country city="Innsbruck">AT</country>
511 <country city="Salzburg">AT</country>
512 <country city="Bern">CH</country>
513 <country city="Biel/Bienne">CH</country>
514 <country city="Zurich">CH</country>
515 <country city="Basel">CH</country>
516 <country city="Geneva">CH</country>
517 <country city="Lucerne">CH</country>
518 <country city="Lausanne">CH</country>
519 <country city="Winterthur">CH</country>
520 <country city="St. Gallen">CH</country>
521 <country city="Interlaken">CH</country>
522 <country city="Brussels">BE</country>
523 <country city="Antwerp">BE</country>
524 <country city="Ghent">BE</country>
525 <country city="Bruges">BE</country>
526 <country city="Leuven">BE</country>
527 <country city="Liege">BE</country>
528 <country city="Charleroi">BE</country>
529 <country city="Namur">BE</country>
530 <country city="Mons">BE</country>
531 <country city="Bangkok">TH</country>
532 <country city="Copenhagen">DK</country>
533 <country city="colatina">BR</country>
534 <country city="Oakland Park">US</country>
535 <country city="Istanbul">TR</country>
536 <country city="Luxemburg">LU</country>
537 <country city="Palma de Mallorca">ES</country>
538 <country city="Swakopmund">NA</country>
539 <country city="Victoria">CA</country>
540 <country city="Wien">AT</country>
541 <country city="Windhoek">NA</country>
542 <country city="Zuerich">CH</country>
543 <country city="Zürich">CH</country>
544 <country city="Zug">CH</country>
545 <country city="ZÜRICH">CH</country>
546 </cities>
547 </xsl:variable>
548
549 <xsl:function name="ids:country-city" as="xs:string">
550 <xsl:param name="city"/>
551 <xsl:value-of select="if ($city-country-mapping/cities/country[@city = $city]) then $city-country-mapping/cities/country[@city = $city] else 'DE'"/>
552 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100553</xsl:stylesheet>