blob: d3620f225d63f310645bfb8dddd70c37bc498b21 [file] [log] [blame]
Marc Kupietz7cc8fc72024-05-26 16:49:38 +02001<?xml version="1.0" encoding="UTF-8"?>
Marc Kupietz1a422662024-03-16 09:34:10 +01002<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 xmlns:opf="http://www.idpf.org/2007/opf"
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:ids="http://www.ids-mannheim.de/ids"
7 xmlns:hlu="http://www.ids-mannheim.de/hlu"
8 xmlns:saxon="http://saxon.sf.net/"
9 xmlns:xhtml="http://www.w3.org/1999/xhtml"
Marc Kupietz10903f32024-04-14 14:21:18 +020010 xmlns:map="http://www.w3.org/2005/xpath-functions/map"
Rebecca Wilme5f055a2024-05-10 15:07:50 +020011 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12 xmlns:srw="http://www.loc.gov/zing/srw/"
13 xmlns:oai="http://www.openarchives.org/OAI/2.0/oai_dc/"
14 exclude-result-prefixes="xs opf dc ids hlu map saxon xhtml xsi srw oai">
Marc Kupietz1a422662024-03-16 09:34:10 +010015
16 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" saxon:line-length="1000"/>
17 <xsl:strip-space elements="*"/>
18
Marc Kupietz7f3fe792024-07-26 15:28:26 +020019 <xsl:param name="debug"/>
20
Marc Kupietz1a422662024-03-16 09:34:10 +010021 <xsl:variable name="ev"/>
22 <xsl:variable name="x"/>
23
Marc Kupietz0df2a572024-05-26 16:54:27 +020024 <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*' , '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010025
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020026 <xsl:variable name="idno_type">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020027 <xsl:choose>
28 <xsl:when test="starts-with($idno,'1')">
29 <xsl:value-of select="'IDN'"/>
30 </xsl:when>
31 <xsl:otherwise>
32 <xsl:value-of select="'ISBN'"/>
33 </xsl:otherwise>
34 </xsl:choose>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020035 </xsl:variable>
36
Marc Kupietz0df2a572024-05-26 16:54:27 +020037 <xsl:variable name="dnbBookdataQuery" as="xs:string">
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 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010040 <xsl:variable name="dnbBookdata">
Marc Kupietz0df2a572024-05-26 16:54:27 +020041 <xsl:copy-of select="doc($dnbBookdataQuery)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010042 </xsl:variable>
43
44 <xsl:variable name="autor"
Marc Kupietzde2ca532024-04-26 16:50:53 +020045 select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietzeaa90132024-04-26 18:14:40 +020046 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
47 <xsl:variable name="translator"
48 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
49 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010050
Marc Kupietz15e7d612024-04-26 18:16:39 +020051 <xsl:variable name="herausgeber"
52 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
53 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010054
55 <xsl:variable name="ina"/>
56 <xsl:variable name="_corpus"/>
57 <xsl:variable name="ent_known"/>
58
59
60 <!-- added HLU 2012-02-09: -->
61 <xsl:variable name="ent">
62 <xsl:choose>
63 <xsl:when test="$ent_known">
64 <xsl:value-of select="$ent_known"/>
65 </xsl:when>
66 <xsl:when test="$ev">
67 <xsl:value-of select="$ev"/>
68 </xsl:when>
69 <xsl:otherwise>
70 <xsl:value-of select="$j"/>
71 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:variable>
74
75 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020076 <xsl:variable name="title-with-subtitles">
77 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020078 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020079 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020080 </xsl:when>
81 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020082 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020083 </xsl:otherwise>
84 </xsl:choose>
85 </xsl:variable>
86 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010087 </xsl:variable>
88
89 <xsl:variable name="erscheinungsort">
90 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020091 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
92 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010093 </xsl:when>
94 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020095 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010096 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:variable>
99
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200100 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
101
Marc Kupietz6cb52232024-04-13 12:28:44 +0200102 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100103
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200104 <xsl:variable name="genretable">
105 <genres>
Nicolas Arnold32118802024-05-31 17:10:05 +0200106 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
107 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
108 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200109 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
110 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200111 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
112 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200113 <genre keyRegex="western" genre="Roman: Westernroman"/>
114 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200115 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
116 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
117 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
118 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
119 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
120 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200121 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
Nicolas Arnold32118802024-05-31 17:10:05 +0200122 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL -->
123 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200124 <genre keyRegex="erzählung" genre="Erzählung"/>
125 <genre keyRegex="novelle" genre="Novelle"/>
126 <genre keyRegex="anthologie" genre="Anthologie"/>
127 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200128 <genre keyRegex="geschichte" genre="Erzählung"/>
129 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200130 <genre keyRegex="roman" genre="Roman"/>
131 <genre keyRegex="." genre="Roman"/>
132 </genres>
133 </xsl:variable>
134
135 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100136 <xsl:variable name="verlag">
137 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200138 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
139 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100140 </xsl:when>
141 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200142 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100143 </xsl:otherwise>
144 </xsl:choose>
145 </xsl:variable>
146
147 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200148 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100149 </xsl:variable>
150
151 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +0200152 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100153
Marc Kupietza5d01182024-04-14 12:24:02 +0200154 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100155
156 <!-- for BOT+s: -->
157 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
158
159 <!-- fuer BOT+b: -->
160 <xsl:variable name="_b">
161 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
162 <xsl:choose>
163 <xsl:when test="matches($dnbBookdata, $regexp1)">
164 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
165 <xsl:matching-substring>
166 <xsl:value-of select="."/>
167 </xsl:matching-substring>
168 </xsl:analyze-string>
169 </xsl:when>
170 <xsl:otherwise>
171 <xsl:value-of select="'.'"/>
172 </xsl:otherwise>
173 </xsl:choose>
174 </xsl:variable>
175
176 <!-- for BOT+x: -->
177 <xsl:variable name="txtart">
178 <xsl:choose>
179 <xsl:when test="$x">
180 <xsl:value-of select="concat('[', $x, ']')"/>
181 </xsl:when>
182 <xsl:when
Nicolas Arnold26355632024-05-10 15:25:41 +0200183 test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100184 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200185 select="concat('[', replace(replace($untertitel, '.*?(((^|\P{L})\p{L}+)?([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)).*', '$1'), '\P{L}*(.+)', '$1'), ']')"
Marc Kupietz1a422662024-03-16 09:34:10 +0100186 />
187 </xsl:when>
188 <xsl:otherwise>
189 <xsl:value-of>Roman</xsl:value-of>
190 </xsl:otherwise>
191 </xsl:choose>
192 </xsl:variable>
193
194
195
196 <!-- fuer BOTd: -->
197 <xsl:variable name="dok"
198 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
199
200 <!-- END variables derived from sru request to dnb archive -->
201
202
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200203 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100204
205 <!-- for BOTD: -->
206 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
207 <xsl:variable name="doc_sigle">
208 <xsl:variable name="firstContentWordTitleInitial">
209 <xsl:variable name="helper">
210 <xsl:analyze-string select="$titel" regex="\w+">
211 <xsl:matching-substring>
212 <xsl:choose>
213 <xsl:when
Marc Kupietzad1f3b82024-04-19 19:21:49 +0200214 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 +0100215 <!-- TODO: Fktnswoerter nachtragen -->
216 <xsl:sequence select="."/>
217 </xsl:when>
218 <xsl:otherwise/>
219 </xsl:choose>
220 </xsl:matching-substring>
221 </xsl:analyze-string>
222 </xsl:variable>
223 <xsl:value-of
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200224 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100225 <!-- longest match of .+ -->
226 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200227 <xsl:variable name="authorInitials">
228 <xsl:choose>
229 <xsl:when test="contains($autor,';')">
230 <xsl:variable name="lastname_aut1"
231 select="upper-case(substring(normalize-space($autor),1,1))"/>
232 <xsl:variable name="lastname_aut2"
233 select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
234 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
235 </xsl:when>
236 <xsl:otherwise>
237 <xsl:variable name="lastname_aut1"
238 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
239 <xsl:variable name="firstname_aut1"
240 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
241 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
242 </xsl:otherwise>
243 </xsl:choose>
244 </xsl:variable>
Marc Kupietz398b5962024-04-21 17:51:34 +0200245 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100246 </xsl:variable>
247
248
Marc Kupietz0c246632024-04-29 07:08:23 +0200249 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100250 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
251
252 <!-- fuer BOT+xy: (?) -->
253 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200254 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100255 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200256 <xsl:text>IDNO:</xsl:text>
257 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100258 <xsl:text>; </xsl:text>
259 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
260 </xsl:variable>
261
Marc Kupietzb660ed62024-03-16 11:45:53 +0100262 <xsl:variable name="long-reference"
263 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
264
265 <xsl:variable name="short-reference"
266 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100267
268 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200269 <!-- for debugging purposes
270 <xsl:message select="concat('uri: ', base-uri())"/>
271 <xsl:message select="concat('idno: ', $idno)"/>
272
273 <xsl:message>
274 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
275 </xsl:message>
276
277 <xsl:message>
278 <xsl:copy-of select="$dnbBookdata"/>
279 </xsl:message>
280 -->
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200281 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200282 <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 +0200283 </xsl:if>
284
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200285 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200286 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200287 </xsl:if>
288
Marc Kupietz2badfb12024-04-19 12:59:40 +0200289 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200290 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200291 </xsl:if>
292
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200293 <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 +0200294 <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 +0200295 </xsl:if>
296
Marc Kupietz1a422662024-03-16 09:34:10 +0100297 <idsDoc TEIform="TEI.2" type="text" version="1.0">
298 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
299 <fileDesc>
300 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100301 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
302 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100303 </titleStmt>
304 <publicationStmt>
305 <distributor/>
306 <pubAddress/>
307 <availability region="world" status="unknown">QAO-NC</availability>
308 <pubDate/>
309 </publicationStmt>
310 <sourceDesc>
311 <biblStruct>
312 <monogr>
313 <h.title type="main"/>
314 <imprint/>
315 </monogr>
316 </biblStruct>
317 </sourceDesc>
318 </fileDesc>
319 </idsHeader>
320 <idsText version="1.0">
321 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
322 <fileDesc>
323 <titleStmt>
324 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100325 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100326 </titleStmt>
327 <publicationStmt>
328 <distributor/>
329 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200330 <xsl:for-each select="$dnbBookdata//dc:identifier">
331 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
332 <xsl:choose>
333 <xsl:when test="@xsi:type='tel:ISBN'">
334 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
335 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
336 </xsl:if>
337 </xsl:when>
Marc Kupietz7582d572024-07-25 16:55:20 +0200338 <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')">
339 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200340 </xsl:when>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200341 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
342 </xsl:choose>
343 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100344 <availability region="world" status="unknown">QAO-NC</availability>
345 <pubDate/>
346 </publicationStmt>
347 <sourceDesc>
348 <biblStruct>
349 <monogr>
350 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
351 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
352 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200353 <xsl:if test="$translator">
354 <editor role="translator"><xsl:value-of select="$translator"/></editor>
355 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200356 <xsl:if test="$herausgeber">
357 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
358 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100359 <edition>
360 <further/>
361 <kind>E-Book-Ausgabe</kind>
362 <appearance>EPUB-Datei</appearance>
363 </edition>
364 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100365 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100366 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
367 <pubDate type="month"/>
368 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200369 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100370 </imprint>
371 <biblScope type="subsume"/>
372 <biblScope type="pp"/>
373 <biblScope type="vol"/>
374 <biblScope type="volume-title"/>
375 </monogr>
376 </biblStruct>
377 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100378 </sourceDesc>
379 </fileDesc>
380 <profileDesc>
381 <creation>
382 <creatDate><xsl:value-of select="$j"/></creatDate>
383 </creation>
384 <textClass/>
385 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200386 <textType><xsl:value-of select="$textFullGenre"/></textType>
387 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100388 <textDomain/>
389 </textDesc>
390 </profileDesc>
391 </idsHeader>
392 <text>
393 <body>
394 <!-- Call the template for each link in the TOC
395 <xsl:apply-templates select="//xhtml:ol[@class='toc']/xhtml:li/xhtml:a" mode="collect"/> -->
Nicolas Arnoldc1c30832024-06-19 12:22:39 +0200396 <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 +0100397 </body>
398 </text>
399 </idsText>
400 </idsDoc>
401 </xsl:template>
402
403 <xsl:template match="opf:item" mode="collect">
404 <xsl:variable name="href" select="@href"/>
Marc Kupietz20ee0e52024-07-27 12:28:58 +0200405 <xsl:if test="$debug">
406 <xsl:message>
407 <xsl:text>converting: </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
408 </xsl:message>
409 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100410 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
411 </xsl:template>
412
413 <xsl:template match="xhtml:body">
414 <div type="chapter">
415 <xsl:apply-templates/>
416 </div>
417 </xsl:template>
418
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000419 <xsl:template match="xhtml:body/text()">
420 <p>
421 <xsl:value-of select="."/>
422 </p>
423 </xsl:template>
424
Marc Kupietz1a422662024-03-16 09:34:10 +0100425 <xsl:template match="xhtml:title">
426 <head>
427 <xsl:apply-templates/>
428 </head>
429 </xsl:template>
430
431 <xsl:template match="xhtml:h1">
432 <head>
433 <xsl:apply-templates/>
434 </head>
435 </xsl:template>
436
Marc Kupietz3989c742024-04-21 17:33:49 +0200437 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100438 <head type="sub">
439 <xsl:apply-templates/>
440 </head>
441 </xsl:template>
442
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100443 <xsl:template match="xhtml:em">
444 <emph>
445 <xsl:apply-templates/>
446 </emph>
447 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100448
Marc Kupietz30cc0802024-04-10 16:37:04 +0200449 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
450 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
451 <hi rend="{$class}">
452 <xsl:apply-templates/>
453 </hi>
454 </xsl:template>
455
Marc Kupietzad4d4462024-04-26 17:43:08 +0200456 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200457 <xsl:apply-templates/>
458 </xsl:template>
459
Marc Kupietz3989c742024-04-21 17:33:49 +0200460 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200461 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100462 <xsl:apply-templates/>
463 </hi>
464 </xsl:template>
465
Nicolas Arnoldc169e832024-06-07 08:44:11 +0200466 <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 +0000467 <hi rend="italic">
468 <xsl:apply-templates/>
469 </hi>
470 </xsl:template>
471
472
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100473 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100474 <hi rend="sub">
475 <xsl:apply-templates/>
476 </hi>
477 </xsl:template>
478
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100479 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100480 <hi rend="sup">
481 <xsl:apply-templates/>
482 </hi>
483 </xsl:template>
484
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000485 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100486
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200487 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
488 <xsl:apply-templates/>
489 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000490 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100491 <p>
492 <xsl:apply-templates/>
493 </p>
494 </xsl:template>
495
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000496 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
497 <div type="section">
498 <xsl:apply-templates/>
499 </div>
500 </xsl:template>
501
502 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
503 <div type="section">
504 <p>
505 <xsl:apply-templates/>
506 </p>
507 </div>
508 </xsl:template>
509
510 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
511 <xsl:if test="normalize-space(.)">
512 <p>
513 <xsl:apply-templates/>
514 </p>
515 </xsl:if>
516 </xsl:template>
517
518 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
519 <xsl:if test="normalize-space(.)">
520 <div type="section">
521 <xsl:apply-templates/>
522 </div>
523 </xsl:if>
524 </xsl:template>
525
Marc Kupietz09745e12024-04-21 12:54:10 +0200526 <xsl:template match="xhtml:ul">
527 <list type="unordered">
528 <xsl:apply-templates/>
529 </list>
530 </xsl:template>
531 <xsl:template match="xhtml:ol">
532 <list type="ordered">
533 <xsl:apply-templates/>
534 </list>
535 </xsl:template>
536 <xsl:template match="xhtml:li">
537 <item>
538 <xsl:apply-templates/>
539 </item>
540 </xsl:template>
541 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200542 <!-- <gap reason="toc"/> -->
543 </xsl:template>
544
Marc Kupietz1a422662024-03-16 09:34:10 +0100545 <xsl:template match="xhtml:img">
546 <!-- <gap reason="image"/> -->
547 </xsl:template>
548
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200549 <xsl:template match="xhtml:audio">
550 <!-- <gap reason="audio"/> -->
551 </xsl:template>
552
Marc Kupietz09745e12024-04-21 12:54:10 +0200553 <xsl:template match="xhtml:table">
554 <!-- <gap reason="table"/> -->
555 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000556 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200557 <xsl:if test="normalize-space(.)">
558 <p>
559 <ref target="{@href}">
560 <xsl:apply-templates />
561 </ref>
562 </p>
563 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000564 </xsl:template>
565
566 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200567 <xsl:if test="$debug">
568 <xsl:message>
569 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
570 </xsl:message>
571 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000572 <div type="section">
573 <p>
574 <xsl:value-of select="."/>
575 </p>
576 </div>
577 </xsl:template>
578 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200579 <xsl:if test="$debug">
580 <xsl:message>
581 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
582 </xsl:message>
583 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000584 <xsl:value-of select="."/>
585 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100586 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200587 <xsl:if test="normalize-space(.)">
588 <ref target="{@href}">
589 <xsl:apply-templates />
590 </ref>
591 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100592 </xsl:template>
593
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200594 <xsl:template match="xhtml:br">
595 <lb/><xsl:text>&#10;</xsl:text>
596 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100597
Marc Kupietz1a422662024-03-16 09:34:10 +0100598 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200599 <xsl:if test="$debug">
600 <xsl:message>
601 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
602 </xsl:message>
603 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000604 <xsl:choose>
605 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
606 <div type="section">
607 <xsl:apply-templates/>
608 </div>
609 </xsl:when>
610 <xsl:otherwise>
611 <xsl:apply-templates select="./*|node()"/>
612 </xsl:otherwise>
613 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100614 <xsl:apply-templates/>
615 </xsl:template>
616
617 <xsl:function name="ids:reversedAuthors">
618 <xsl:param name="s" />
619 <xsl:value-of
620 select="
621 if (matches($s, ';')) then
622 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
623 else
624 replace($s, '(.+) (.+)', '$2, $1')"
625 />
626 </xsl:function>
627
628 <xsl:function name="hlu:reversedAuthors">
629 <xsl:param name="s"/>
630 <xsl:value-of
631 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
632 />
633 </xsl:function>
634
Marc Kupietz10903f32024-04-14 14:21:18 +0200635 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
636 <xsl:map>
637 <xsl:map-entry key="'Axams'" select="'AT'"/>
638 <xsl:map-entry key="'Vienna'" select="'AT'"/>
639 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
640 <xsl:map-entry key="'Graz'" select="'AT'"/>
641 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
642 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
643 <xsl:map-entry key="'Bern'" select="'CH'"/>
644 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
645 <xsl:map-entry key="'Zurich'" select="'CH'"/>
646 <xsl:map-entry key="'Basel'" select="'CH'"/>
647 <xsl:map-entry key="'Geneva'" select="'CH'"/>
648 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
649 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
650 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
651 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
652 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
653 <xsl:map-entry key="'Brussels'" select="'BE'"/>
654 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
655 <xsl:map-entry key="'Ghent'" select="'BE'"/>
656 <xsl:map-entry key="'Bruges'" select="'BE'"/>
657 <xsl:map-entry key="'Leuven'" select="'BE'"/>
658 <xsl:map-entry key="'Liege'" select="'BE'"/>
659 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
660 <xsl:map-entry key="'Namur'" select="'BE'"/>
661 <xsl:map-entry key="'Mons'" select="'BE'"/>
662 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
663 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
664 <xsl:map-entry key="'colatina'" select="'BR'"/>
665 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
666 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
667 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
668 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
669 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
670 <xsl:map-entry key="'Victoria'" select="'CA'"/>
671 <xsl:map-entry key="'Wien'" select="'AT'"/>
672 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
673 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
674 <xsl:map-entry key="'Zürich'" select="'CH'"/>
675 <xsl:map-entry key="'Zug'" select="'CH'"/>
676 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
677 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200678
Marc Kupietz10903f32024-04-14 14:21:18 +0200679 </xsl:variable>
680
681 <!-- Define the function -->
682 <xsl:function name="ids:country-city" as="xs:string">
683 <xsl:param name="city" as="xs:string"/>
684 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
685 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100686</xsl:stylesheet>