blob: 09ebeac99b8390500eb699383afb05bf0dfa9f68 [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 Kupietz6cb52232024-04-13 12:28:44 +020075 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +010076
Marc Kupietz1a422662024-03-16 09:34:10 +010077 <xsl:variable name="verlag">
78 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020079 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
80 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010081 </xsl:when>
82 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020083 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010084 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:variable>
87
88 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +020089 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010090 </xsl:variable>
91
92 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +020093 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010094
95 <xsl:variable name="herausgeber">
96 <xsl:choose>
97 <xsl:when test="$dnbBookdata//dc:creator[ends-with(.,'[Hrsg.]')]">
98 <xsl:value-of
Marc Kupietz6cb52232024-04-13 12:28:44 +020099 select="replace(string-join($dnbBookdata//dc:creator[ends-with(.,'[Hrsg.]')][1], ' ; '),'\s?\[Hrsg.\]','')"
Marc Kupietz1a422662024-03-16 09:34:10 +0100100 />
101 </xsl:when>
102 <xsl:otherwise>.</xsl:otherwise>
103 </xsl:choose>
104 </xsl:variable>
105
106 <xsl:variable name="straight_herausgeber"
107 select="replace(hlu:reversedAuthors($herausgeber), ',', '')"/>
108
Marc Kupietza5d01182024-04-14 12:24:02 +0200109 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100110
111 <!-- for BOT+s: -->
112 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
113
114 <!-- fuer BOT+b: -->
115 <xsl:variable name="_b">
116 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
117 <xsl:choose>
118 <xsl:when test="matches($dnbBookdata, $regexp1)">
119 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
120 <xsl:matching-substring>
121 <xsl:value-of select="."/>
122 </xsl:matching-substring>
123 </xsl:analyze-string>
124 </xsl:when>
125 <xsl:otherwise>
126 <xsl:value-of select="'.'"/>
127 </xsl:otherwise>
128 </xsl:choose>
129 </xsl:variable>
130
131 <!-- for BOT+x: -->
132 <xsl:variable name="txtart">
133 <xsl:choose>
134 <xsl:when test="$x">
135 <xsl:value-of select="concat('[', $x, ']')"/>
136 </xsl:when>
137 <xsl:when
138 test="matches($untertitel, '([Rr]oman|[Ee]rzhlung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
139 <xsl:value-of
140 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'), ']')"
141 />
142 </xsl:when>
143 <xsl:otherwise>
144 <xsl:value-of>Roman</xsl:value-of>
145 </xsl:otherwise>
146 </xsl:choose>
147 </xsl:variable>
148
149
150
151 <!-- fuer BOTd: -->
152 <xsl:variable name="dok"
153 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
154
155 <!-- END variables derived from sru request to dnb archive -->
156
157
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200158 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100159
160 <!-- for BOTD: -->
161 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
162 <xsl:variable name="doc_sigle">
163 <xsl:variable name="firstContentWordTitleInitial">
164 <xsl:variable name="helper">
165 <xsl:analyze-string select="$titel" regex="\w+">
166 <xsl:matching-substring>
167 <xsl:choose>
168 <xsl:when
169 test="matches(.,'^[A-Z]') and not(matches(.,'^(Der|Die|Das|Des|Ein|Eine|Eines|Einmal|Von|Mit|Zu|Zurck)$'))">
170 <!-- TODO: Fktnswoerter nachtragen -->
171 <xsl:sequence select="."/>
172 </xsl:when>
173 <xsl:otherwise/>
174 </xsl:choose>
175 </xsl:matching-substring>
176 </xsl:analyze-string>
177 </xsl:variable>
178 <xsl:value-of
179 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,1))"/>
180 <!-- longest match of .+ -->
181 </xsl:variable>
182 <xsl:choose>
183 <xsl:when test="contains($autor,';')">
184 <xsl:variable name="lastname_aut1"
185 select="upper-case(substring(normalize-space(substring-before(substring-before($autor,';'),',')), 1, 1))"/>
186 <xsl:variable name="lastname_aut2"
187 select="upper-case(substring(normalize-space(substring-before(substring-before(substring-after($autor, ';'),';'),',')), 1, 1))"/>
188 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:variable name="lastname_aut1"
192 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
193 <xsl:variable name="firstname_aut1"
194 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
195 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
196 </xsl:otherwise>
197 </xsl:choose>
198 <xsl:value-of select="$firstContentWordTitleInitial"/>
199 </xsl:variable>
200
201
202 <xsl:variable name="text_sigle" select="substring($isbn, 8, 5)"/>
203 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
204
205 <!-- fuer BOT+xy: (?) -->
206 <xsl:variable name="xyref">
207 <xsl:value-of select="document-uri(.)"/>
208 <xsl:text>; </xsl:text>
209 <xsl:text>ISBN:</xsl:text>
210 <xsl:value-of select="$isbn"/>
211 <xsl:text>; </xsl:text>
212 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
213 </xsl:variable>
214
Marc Kupietzb660ed62024-03-16 11:45:53 +0100215 <xsl:variable name="long-reference"
216 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
217
218 <xsl:variable name="short-reference"
219 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100220
221 <xsl:template match="/">
222 <idsDoc TEIform="TEI.2" type="text" version="1.0">
223 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
224 <fileDesc>
225 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100226 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
227 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100228 </titleStmt>
229 <publicationStmt>
230 <distributor/>
231 <pubAddress/>
232 <availability region="world" status="unknown">QAO-NC</availability>
233 <pubDate/>
234 </publicationStmt>
235 <sourceDesc>
236 <biblStruct>
237 <monogr>
238 <h.title type="main"/>
239 <imprint/>
240 </monogr>
241 </biblStruct>
242 </sourceDesc>
243 </fileDesc>
244 </idsHeader>
245 <idsText version="1.0">
246 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
247 <fileDesc>
248 <titleStmt>
249 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100250 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100251 </titleStmt>
252 <publicationStmt>
253 <distributor/>
254 <pubAddress/>
255 <availability region="world" status="unknown">QAO-NC</availability>
256 <pubDate/>
257 </publicationStmt>
258 <sourceDesc>
259 <biblStruct>
260 <monogr>
261 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
262 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
263 <h.author><xsl:value-of select="$autor"/></h.author>
264 <editor/>
265 <edition>
266 <further/>
267 <kind>E-Book-Ausgabe</kind>
268 <appearance>EPUB-Datei</appearance>
269 </edition>
270 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100271 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100272 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
273 <pubDate type="month"/>
274 <pubDate type="day"/>
275 <pubPlace key="DE"><xsl:value-of select="$erscheinungsort"/></pubPlace>
276 </imprint>
277 <biblScope type="subsume"/>
278 <biblScope type="pp"/>
279 <biblScope type="vol"/>
280 <biblScope type="volume-title"/>
281 </monogr>
282 </biblStruct>
283 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100284 </sourceDesc>
285 </fileDesc>
286 <profileDesc>
287 <creation>
288 <creatDate><xsl:value-of select="$j"/></creatDate>
289 </creation>
290 <textClass/>
291 <textDesc>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100292 <textType><xsl:value-of select="$texttype"/></textType>
293 <textTypeRef><xsl:value-of select="$texttype"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100294 <textDomain/>
295 </textDesc>
296 </profileDesc>
297 </idsHeader>
298 <text>
299 <body>
300 <!-- Call the template for each link in the TOC
301 <xsl:apply-templates select="//xhtml:ol[@class='toc']/xhtml:li/xhtml:a" mode="collect"/> -->
Marc Kupietz8f727302024-04-10 16:31:19 +0200302 <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 +0100303 </body>
304 </text>
305 </idsText>
306 </idsDoc>
307 </xsl:template>
308
309 <xsl:template match="opf:item" mode="collect">
310 <xsl:variable name="href" select="@href"/>
311 <xsl:message>
312 <xsl:text>converting: </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$isbn"/>
313 </xsl:message>
314 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
315 </xsl:template>
316
317 <xsl:template match="xhtml:body">
318 <div type="chapter">
319 <xsl:apply-templates/>
320 </div>
321 </xsl:template>
322
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000323 <xsl:template match="xhtml:body/text()">
324 <p>
325 <xsl:value-of select="."/>
326 </p>
327 </xsl:template>
328
Marc Kupietz1a422662024-03-16 09:34:10 +0100329 <xsl:template match="xhtml:title">
330 <head>
331 <xsl:apply-templates/>
332 </head>
333 </xsl:template>
334
335 <xsl:template match="xhtml:h1">
336 <head>
337 <xsl:apply-templates/>
338 </head>
339 </xsl:template>
340
341 <xsl:template match="xhtml:h2|xhtml:h3">
342 <head type="sub">
343 <xsl:apply-templates/>
344 </head>
345 </xsl:template>
346
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100347 <xsl:template match="xhtml:em">
348 <emph>
349 <xsl:apply-templates/>
350 </emph>
351 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100352
Marc Kupietz30cc0802024-04-10 16:37:04 +0200353 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
354 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
355 <hi rend="{$class}">
356 <xsl:apply-templates/>
357 </hi>
358 </xsl:template>
359
360 <xsl:template match="xhtml:b">
361 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100362 <xsl:apply-templates/>
363 </hi>
364 </xsl:template>
365
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000366 <xsl:template match="xhtml:i">
367 <hi rend="italic">
368 <xsl:apply-templates/>
369 </hi>
370 </xsl:template>
371
372
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100373 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100374 <hi rend="sub">
375 <xsl:apply-templates/>
376 </hi>
377 </xsl:template>
378
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100379 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100380 <hi rend="sup">
381 <xsl:apply-templates/>
382 </hi>
383 </xsl:template>
384
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000385 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100386
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000387 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100388 <p>
389 <xsl:apply-templates/>
390 </p>
391 </xsl:template>
392
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000393 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
394 <div type="section">
395 <xsl:apply-templates/>
396 </div>
397 </xsl:template>
398
399 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
400 <div type="section">
401 <p>
402 <xsl:apply-templates/>
403 </p>
404 </div>
405 </xsl:template>
406
407 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
408 <xsl:if test="normalize-space(.)">
409 <p>
410 <xsl:apply-templates/>
411 </p>
412 </xsl:if>
413 </xsl:template>
414
415 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
416 <xsl:if test="normalize-space(.)">
417 <div type="section">
418 <xsl:apply-templates/>
419 </div>
420 </xsl:if>
421 </xsl:template>
422
423 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200424 <!-- <gap reason="toc"/> -->
425 </xsl:template>
426
Marc Kupietz1a422662024-03-16 09:34:10 +0100427 <xsl:template match="xhtml:img">
428 <!-- <gap reason="image"/> -->
429 </xsl:template>
430
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200431 <xsl:template match="xhtml:audio">
432 <!-- <gap reason="audio"/> -->
433 </xsl:template>
434
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000435 <xsl:template match="xhtml:body/xhtml:a">
436 <p>
437 <ref target="{@href}">
438 <xsl:apply-templates />
439 </ref>
440 </p>
441 </xsl:template>
442
443 <xsl:template match="xhtml:body/xhtml:span">
444 <xsl:message>
445 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
446 </xsl:message>
447 <div type="section">
448 <p>
449 <xsl:value-of select="."/>
450 </p>
451 </div>
452 </xsl:template>
453 <xsl:template match="xhtml:span">
454 <xsl:message>
455 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
456 </xsl:message>
457 <xsl:value-of select="."/>
458 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100459 <xsl:template match="xhtml:a">
460 <ref target="{@href}">
461 <xsl:apply-templates />
462 </ref>
463 </xsl:template>
464
465 <xsl:template match="xhtml:br"/>
466
Marc Kupietz1a422662024-03-16 09:34:10 +0100467 <xsl:template match="xhtml:*">
468 <xsl:message>
469 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
470 </xsl:message>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000471 <xsl:choose>
472 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
473 <div type="section">
474 <xsl:apply-templates/>
475 </div>
476 </xsl:when>
477 <xsl:otherwise>
478 <xsl:apply-templates select="./*|node()"/>
479 </xsl:otherwise>
480 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100481 <xsl:apply-templates/>
482 </xsl:template>
483
484 <xsl:function name="ids:reversedAuthors">
485 <xsl:param name="s" />
486 <xsl:value-of
487 select="
488 if (matches($s, ';')) then
489 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
490 else
491 replace($s, '(.+) (.+)', '$2, $1')"
492 />
493 </xsl:function>
494
495 <xsl:function name="hlu:reversedAuthors">
496 <xsl:param name="s"/>
497 <xsl:value-of
498 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
499 />
500 </xsl:function>
501
502</xsl:stylesheet>