blob: d1c5ae9864477b247ea2764e16cd28cf1c3a8b42 [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"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020023
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>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +020036
Marc Kupietz1c3ebca2024-09-22 13:49:28 +020037 <xsl:param name="buchpreis"/>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020038
Marc Kupietz0df2a572024-05-26 16:54:27 +020039 <xsl:variable name="dnbBookdataQuery" as="xs:string">
40 <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')"/>
41 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010042 <xsl:variable name="dnbBookdata">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +020043 <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="concat('debug message original title from static metadata: ', if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno]//dc:title else '')"/>
47 </xsl:if>
Marc Kupietzf475f222024-09-30 15:01:06 +020048 <xsl:variable name="tmp" select="if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno] else doc($dnbBookdataQuery)"/>
49 <xsl:copy-of select="if($tmp//dc:title) then $tmp else doc('static_metadata.xml')//oai:dc[replace(dc:identifier[@xsi:type='tel:ISBN'][1], '-', '')=$idno]"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010050 </xsl:variable>
51
52 <xsl:variable name="autor"
Marc Kupietzde2ca532024-04-26 16:50:53 +020053 select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietzeaa90132024-04-26 18:14:40 +020054 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
55 <xsl:variable name="translator"
56 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
57 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010058
Marc Kupietz15e7d612024-04-26 18:16:39 +020059 <xsl:variable name="herausgeber"
60 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
61 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010062
63 <xsl:variable name="ina"/>
64 <xsl:variable name="_corpus"/>
65 <xsl:variable name="ent_known"/>
66
67
68 <!-- added HLU 2012-02-09: -->
69 <xsl:variable name="ent">
70 <xsl:choose>
71 <xsl:when test="$ent_known">
72 <xsl:value-of select="$ent_known"/>
73 </xsl:when>
74 <xsl:when test="$ev">
75 <xsl:value-of select="$ev"/>
76 </xsl:when>
77 <xsl:otherwise>
78 <xsl:value-of select="$j"/>
79 </xsl:otherwise>
80 </xsl:choose>
81 </xsl:variable>
82
83 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020084 <xsl:variable name="title-with-subtitles">
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +020085 <xsl:if test="$debug">
86 <xsl:message select="concat('title: ', ($dnbBookdata//dc:title)[1])"/>
87 </xsl:if>
Marc Kupietz49124fa2024-04-10 16:50:01 +020088 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020089 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
Marc Kupietz744d30e2024-09-22 12:49:45 +020090 <xsl:choose>
91 <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')">
92 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
96 </xsl:otherwise>
97 </xsl:choose>
Marc Kupietz49124fa2024-04-10 16:50:01 +020098 </xsl:when>
Marc Kupietzb9903542024-09-30 14:02:18 +020099 <xsl:when test="contains(($dnbBookdata//dc:title)[1],'/')">
Marc Kupietz6cb52232024-04-13 12:28:44 +0200100 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietzb9903542024-09-30 14:02:18 +0200101 </xsl:when>
102 <xsl:otherwise>
103 <xsl:value-of select="normalize-space(($dnbBookdata//dc:title)[1])"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +0200104 </xsl:otherwise>
105 </xsl:choose>
106 </xsl:variable>
107 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100108 </xsl:variable>
109
110 <xsl:variable name="erscheinungsort">
111 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200112 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
113 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100114 </xsl:when>
115 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200116 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100117 </xsl:otherwise>
118 </xsl:choose>
119 </xsl:variable>
120
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200121 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
122
Marc Kupietz6cb52232024-04-13 12:28:44 +0200123 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100124
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200125 <xsl:variable name="genretable">
126 <genres>
Nicolas Arnold32118802024-05-31 17:10:05 +0200127 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
128 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
129 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200130 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
131 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200132 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
133 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200134 <genre keyRegex="western" genre="Roman: Westernroman"/>
135 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200136 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
137 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
138 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
139 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
140 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
141 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200142 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
Nicolas Arnold32118802024-05-31 17:10:05 +0200143 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL -->
144 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200145 <genre keyRegex="erzählung" genre="Erzählung"/>
146 <genre keyRegex="novelle" genre="Novelle"/>
147 <genre keyRegex="anthologie" genre="Anthologie"/>
148 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200149 <genre keyRegex="geschichte" genre="Erzählung"/>
150 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200151 <genre keyRegex="roman" genre="Roman"/>
152 <genre keyRegex="." genre="Roman"/>
153 </genres>
154 </xsl:variable>
155
156 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100157 <xsl:variable name="verlag">
158 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200159 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
160 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100161 </xsl:when>
162 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200163 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100164 </xsl:otherwise>
165 </xsl:choose>
166 </xsl:variable>
167
168 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200169 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100170 </xsl:variable>
171
172 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +0200173 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100174
Marc Kupietza5d01182024-04-14 12:24:02 +0200175 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100176
177 <!-- for BOT+s: -->
178 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
179
180 <!-- fuer BOT+b: -->
181 <xsl:variable name="_b">
182 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
183 <xsl:choose>
184 <xsl:when test="matches($dnbBookdata, $regexp1)">
185 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
186 <xsl:matching-substring>
187 <xsl:value-of select="."/>
188 </xsl:matching-substring>
189 </xsl:analyze-string>
190 </xsl:when>
191 <xsl:otherwise>
192 <xsl:value-of select="'.'"/>
193 </xsl:otherwise>
194 </xsl:choose>
195 </xsl:variable>
196
197 <!-- for BOT+x: -->
198 <xsl:variable name="txtart">
199 <xsl:choose>
200 <xsl:when test="$x">
201 <xsl:value-of select="concat('[', $x, ']')"/>
202 </xsl:when>
203 <xsl:when
Nicolas Arnold26355632024-05-10 15:25:41 +0200204 test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100205 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200206 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 +0100207 />
208 </xsl:when>
209 <xsl:otherwise>
210 <xsl:value-of>Roman</xsl:value-of>
211 </xsl:otherwise>
212 </xsl:choose>
213 </xsl:variable>
214
215
216
217 <!-- fuer BOTd: -->
218 <xsl:variable name="dok"
219 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
220
221 <!-- END variables derived from sru request to dnb archive -->
222
223
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200224 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100225
226 <!-- for BOTD: -->
227 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
228 <xsl:variable name="doc_sigle">
229 <xsl:variable name="firstContentWordTitleInitial">
230 <xsl:variable name="helper">
231 <xsl:analyze-string select="$titel" regex="\w+">
232 <xsl:matching-substring>
233 <xsl:choose>
234 <xsl:when
Marc Kupietzad1f3b82024-04-19 19:21:49 +0200235 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 +0100236 <!-- TODO: Fktnswoerter nachtragen -->
237 <xsl:sequence select="."/>
238 </xsl:when>
239 <xsl:otherwise/>
240 </xsl:choose>
241 </xsl:matching-substring>
242 </xsl:analyze-string>
243 </xsl:variable>
244 <xsl:value-of
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200245 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100246 <!-- longest match of .+ -->
247 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200248 <xsl:variable name="authorInitials">
249 <xsl:choose>
250 <xsl:when test="contains($autor,';')">
251 <xsl:variable name="lastname_aut1"
252 select="upper-case(substring(normalize-space($autor),1,1))"/>
253 <xsl:variable name="lastname_aut2"
254 select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
255 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
256 </xsl:when>
257 <xsl:otherwise>
258 <xsl:variable name="lastname_aut1"
259 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
260 <xsl:variable name="firstname_aut1"
261 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
262 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
263 </xsl:otherwise>
264 </xsl:choose>
265 </xsl:variable>
Marc Kupietz398b5962024-04-21 17:51:34 +0200266 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100267 </xsl:variable>
268
269
Marc Kupietz0c246632024-04-29 07:08:23 +0200270 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100271 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
272
273 <!-- fuer BOT+xy: (?) -->
274 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200275 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100276 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200277 <xsl:text>IDNO:</xsl:text>
278 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100279 <xsl:text>; </xsl:text>
280 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
281 </xsl:variable>
282
Marc Kupietzb660ed62024-03-16 11:45:53 +0100283 <xsl:variable name="long-reference"
284 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
285
286 <xsl:variable name="short-reference"
287 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100288
289 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200290 <!-- for debugging purposes
291 <xsl:message select="concat('uri: ', base-uri())"/>
292 <xsl:message select="concat('idno: ', $idno)"/>
293
294 <xsl:message>
295 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
296 </xsl:message>
297
298 <xsl:message>
299 <xsl:copy-of select="$dnbBookdata"/>
300 </xsl:message>
301 -->
Harald Luengenb81b63b2025-01-09 15:44:14 +0100302
303
Marc Kupietz2c7bc7e2024-09-30 14:09:25 +0200304 <xsl:if test="not($dnbBookdata//oai:dc)">
305 <xsl:message terminate="yes" default-mode="text">ERROR: No metadata found for IDNO: <xsl:value-of select="$idno"/>
306 <xsl:text>&#10;Query was: </xsl:text>
307 <xsl:value-of disable-output-escaping="yes" select="replace($dnbBookdataQuery, '&amp;', '%38')"/>
308 <xsl:text>&#10;Retrieved response: </xsl:text>
309 <xsl:copy-of select="$dnbBookdata"/>
310 </xsl:message>
311 </xsl:if>
312
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200313 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200314 <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 +0200315 </xsl:if>
316
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200317 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200318 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200319 </xsl:if>
320
Marc Kupietz2badfb12024-04-19 12:59:40 +0200321 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200322 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200323 </xsl:if>
324
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200325 <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 +0200326 <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 +0200327 </xsl:if>
328
Marc Kupietz1a422662024-03-16 09:34:10 +0100329 <idsDoc TEIform="TEI.2" type="text" version="1.0">
330 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
331 <fileDesc>
332 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100333 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
334 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100335 </titleStmt>
336 <publicationStmt>
337 <distributor/>
338 <pubAddress/>
339 <availability region="world" status="unknown">QAO-NC</availability>
340 <pubDate/>
341 </publicationStmt>
342 <sourceDesc>
343 <biblStruct>
344 <monogr>
345 <h.title type="main"/>
346 <imprint/>
347 </monogr>
348 </biblStruct>
349 </sourceDesc>
350 </fileDesc>
351 </idsHeader>
352 <idsText version="1.0">
353 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
354 <fileDesc>
355 <titleStmt>
356 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100357 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100358 </titleStmt>
359 <publicationStmt>
360 <distributor/>
361 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200362 <xsl:for-each select="$dnbBookdata//dc:identifier">
363 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
364 <xsl:choose>
365 <xsl:when test="@xsi:type='tel:ISBN'">
366 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
367 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
368 </xsl:if>
369 </xsl:when>
Marc Kupietz7582d572024-07-25 16:55:20 +0200370 <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')">
371 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200372 </xsl:when>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200373 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
374 </xsl:choose>
375 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100376 <availability region="world" status="unknown">QAO-NC</availability>
377 <pubDate/>
378 </publicationStmt>
379 <sourceDesc>
380 <biblStruct>
381 <monogr>
382 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
383 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
384 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200385 <xsl:if test="$translator">
386 <editor role="translator"><xsl:value-of select="$translator"/></editor>
387 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200388 <xsl:if test="$herausgeber">
389 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
390 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100391 <edition>
392 <further/>
393 <kind>E-Book-Ausgabe</kind>
394 <appearance>EPUB-Datei</appearance>
395 </edition>
396 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100397 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100398 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
399 <pubDate type="month"/>
400 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200401 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100402 </imprint>
403 <biblScope type="subsume"/>
404 <biblScope type="pp"/>
405 <biblScope type="vol"/>
406 <biblScope type="volume-title"/>
407 </monogr>
Marc Kupietz1c3ebca2024-09-22 13:49:28 +0200408 <xsl:if test="$buchpreis">
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200409 <xsl:element name="note">
410 <xsl:attribute name="type">award</xsl:attribute>
411 <xsl:attribute name="subtype">
Marc Kupietze43c7202024-09-22 12:53:41 +0200412 <xsl:value-of select="'Buchpreis deutscher_buchpreis'"/>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200413 </xsl:attribute>
414 </xsl:element>
415 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100416 </biblStruct>
417 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100418 </sourceDesc>
419 </fileDesc>
420 <profileDesc>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100421 <!-- outcommented HL -->
422 <!--creation>
Marc Kupietz1a422662024-03-16 09:34:10 +0100423 <creatDate><xsl:value-of select="$j"/></creatDate>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100424 </creation-->
425 <!-- BEGIN HL -->
426 <xsl:call-template name="creation_temp">
427 <xsl:with-param name="j" select="$j"/>
428 </xsl:call-template>
429 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100430 <textClass/>
431 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200432 <textType><xsl:value-of select="$textFullGenre"/></textType>
433 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100434 <textDomain/>
435 </textDesc>
436 </profileDesc>
437 </idsHeader>
438 <text>
439 <body>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200440 <!-- Call the template for each idref the spine -->
441 <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100442 </body>
443 </text>
444 </idsText>
445 </idsDoc>
446 </xsl:template>
Harald Luengenb81b63b2025-01-09 15:44:14 +0100447
448 <!-- BEGIN HL -->
449 <xsl:template name="creation_temp">
450 <xsl:param name="j"/>
451 <creation>
452 <creatDate><xsl:value-of select="$j"/></creatDate>
453 </creation>
454 </xsl:template>
455 <!-- END HL -->
Marc Kupietz1a422662024-03-16 09:34:10 +0100456
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200457 <xsl:template match="opf:itemref" mode="collect">
458 <xsl:variable name="id" select="@idref"/>
459 <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).*'))]"/>
460
461 <xsl:choose>
462 <xsl:when test = "$item">
463 <xsl:variable name="href" select="$item/@href"/>
464 <xsl:if test="$debug">
465 <xsl:message>
466 <xsl:text>converting: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
467 </xsl:message>
468 </xsl:if>
469 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
470 </xsl:when>
471 <xsl:otherwise>
472 <xsl:if test="$debug">
473 <xsl:message>
474 <xsl:text>skipping: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
475 </xsl:message>
476 </xsl:if>
477 </xsl:otherwise>
478 </xsl:choose>
479 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100480
481 <xsl:template match="xhtml:body">
482 <div type="chapter">
483 <xsl:apply-templates/>
484 </div>
485 </xsl:template>
486
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000487 <xsl:template match="xhtml:body/text()">
488 <p>
489 <xsl:value-of select="."/>
490 </p>
491 </xsl:template>
492
Marc Kupietz1a422662024-03-16 09:34:10 +0100493 <xsl:template match="xhtml:title">
494 <head>
495 <xsl:apply-templates/>
496 </head>
497 </xsl:template>
498
499 <xsl:template match="xhtml:h1">
500 <head>
501 <xsl:apply-templates/>
502 </head>
503 </xsl:template>
504
Marc Kupietz3989c742024-04-21 17:33:49 +0200505 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100506 <head type="sub">
507 <xsl:apply-templates/>
508 </head>
509 </xsl:template>
510
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100511 <xsl:template match="xhtml:em">
512 <emph>
513 <xsl:apply-templates/>
514 </emph>
515 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100516
Marc Kupietz30cc0802024-04-10 16:37:04 +0200517 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
518 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
519 <hi rend="{$class}">
520 <xsl:apply-templates/>
521 </hi>
522 </xsl:template>
523
Marc Kupietzad4d4462024-04-26 17:43:08 +0200524 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200525 <xsl:apply-templates/>
526 </xsl:template>
527
Marc Kupietz3989c742024-04-21 17:33:49 +0200528 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200529 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100530 <xsl:apply-templates/>
531 </hi>
532 </xsl:template>
533
Nicolas Arnoldc169e832024-06-07 08:44:11 +0200534 <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 +0000535 <hi rend="italic">
536 <xsl:apply-templates/>
537 </hi>
538 </xsl:template>
539
540
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100541 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100542 <hi rend="sub">
543 <xsl:apply-templates/>
544 </hi>
545 </xsl:template>
546
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100547 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100548 <hi rend="sup">
549 <xsl:apply-templates/>
550 </hi>
551 </xsl:template>
552
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000553 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100554
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200555 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
556 <xsl:apply-templates/>
557 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000558 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100559 <p>
560 <xsl:apply-templates/>
561 </p>
562 </xsl:template>
563
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000564 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
565 <div type="section">
566 <xsl:apply-templates/>
567 </div>
568 </xsl:template>
569
570 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
571 <div type="section">
572 <p>
573 <xsl:apply-templates/>
574 </p>
575 </div>
576 </xsl:template>
577
578 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
579 <xsl:if test="normalize-space(.)">
580 <p>
581 <xsl:apply-templates/>
582 </p>
583 </xsl:if>
584 </xsl:template>
585
586 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
587 <xsl:if test="normalize-space(.)">
588 <div type="section">
589 <xsl:apply-templates/>
590 </div>
591 </xsl:if>
592 </xsl:template>
593
Marc Kupietz09745e12024-04-21 12:54:10 +0200594 <xsl:template match="xhtml:ul">
595 <list type="unordered">
596 <xsl:apply-templates/>
597 </list>
598 </xsl:template>
599 <xsl:template match="xhtml:ol">
600 <list type="ordered">
601 <xsl:apply-templates/>
602 </list>
603 </xsl:template>
604 <xsl:template match="xhtml:li">
605 <item>
606 <xsl:apply-templates/>
607 </item>
608 </xsl:template>
609 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200610 <!-- <gap reason="toc"/> -->
611 </xsl:template>
612
Marc Kupietz1a422662024-03-16 09:34:10 +0100613 <xsl:template match="xhtml:img">
614 <!-- <gap reason="image"/> -->
615 </xsl:template>
616
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200617 <xsl:template match="xhtml:audio">
618 <!-- <gap reason="audio"/> -->
619 </xsl:template>
620
Marc Kupietz09745e12024-04-21 12:54:10 +0200621 <xsl:template match="xhtml:table">
622 <!-- <gap reason="table"/> -->
623 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000624 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200625 <xsl:if test="normalize-space(.)">
626 <p>
627 <ref target="{@href}">
628 <xsl:apply-templates />
629 </ref>
630 </p>
631 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000632 </xsl:template>
633
634 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200635 <xsl:if test="$debug">
636 <xsl:message>
637 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
638 </xsl:message>
639 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000640 <div type="section">
641 <p>
642 <xsl:value-of select="."/>
643 </p>
644 </div>
645 </xsl:template>
646 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200647 <xsl:if test="$debug">
648 <xsl:message>
649 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
650 </xsl:message>
651 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000652 <xsl:value-of select="."/>
653 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100654 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200655 <xsl:if test="normalize-space(.)">
656 <ref target="{@href}">
657 <xsl:apply-templates />
658 </ref>
659 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100660 </xsl:template>
661
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200662 <xsl:template match="xhtml:br">
663 <lb/><xsl:text>&#10;</xsl:text>
664 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100665
Marc Kupietz1a422662024-03-16 09:34:10 +0100666 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200667 <xsl:if test="$debug">
668 <xsl:message>
669 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
670 </xsl:message>
671 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000672 <xsl:choose>
673 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
674 <div type="section">
675 <xsl:apply-templates/>
676 </div>
677 </xsl:when>
678 <xsl:otherwise>
679 <xsl:apply-templates select="./*|node()"/>
680 </xsl:otherwise>
681 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100682 <xsl:apply-templates/>
683 </xsl:template>
684
685 <xsl:function name="ids:reversedAuthors">
686 <xsl:param name="s" />
687 <xsl:value-of
688 select="
689 if (matches($s, ';')) then
690 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
691 else
692 replace($s, '(.+) (.+)', '$2, $1')"
693 />
694 </xsl:function>
695
696 <xsl:function name="hlu:reversedAuthors">
697 <xsl:param name="s"/>
698 <xsl:value-of
699 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
700 />
701 </xsl:function>
702
Marc Kupietz10903f32024-04-14 14:21:18 +0200703 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
704 <xsl:map>
705 <xsl:map-entry key="'Axams'" select="'AT'"/>
706 <xsl:map-entry key="'Vienna'" select="'AT'"/>
707 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
708 <xsl:map-entry key="'Graz'" select="'AT'"/>
709 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
710 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
711 <xsl:map-entry key="'Bern'" select="'CH'"/>
712 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
713 <xsl:map-entry key="'Zurich'" select="'CH'"/>
714 <xsl:map-entry key="'Basel'" select="'CH'"/>
715 <xsl:map-entry key="'Geneva'" select="'CH'"/>
716 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
717 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
718 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
719 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
720 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
721 <xsl:map-entry key="'Brussels'" select="'BE'"/>
722 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
723 <xsl:map-entry key="'Ghent'" select="'BE'"/>
724 <xsl:map-entry key="'Bruges'" select="'BE'"/>
725 <xsl:map-entry key="'Leuven'" select="'BE'"/>
726 <xsl:map-entry key="'Liege'" select="'BE'"/>
727 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
728 <xsl:map-entry key="'Namur'" select="'BE'"/>
729 <xsl:map-entry key="'Mons'" select="'BE'"/>
730 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
731 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
732 <xsl:map-entry key="'colatina'" select="'BR'"/>
733 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
734 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
735 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
736 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
737 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
738 <xsl:map-entry key="'Victoria'" select="'CA'"/>
739 <xsl:map-entry key="'Wien'" select="'AT'"/>
740 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
741 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
742 <xsl:map-entry key="'Zürich'" select="'CH'"/>
743 <xsl:map-entry key="'Zug'" select="'CH'"/>
744 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
745 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200746
Marc Kupietz10903f32024-04-14 14:21:18 +0200747 </xsl:variable>
748
749 <!-- Define the function -->
750 <xsl:function name="ids:country-city" as="xs:string">
751 <xsl:param name="city" as="xs:string"/>
752 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
753 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100754</xsl:stylesheet>