blob: bf8e9fb854b3057cb00c7d12b640cfbb0fee2d04 [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
37 <xsl:variable name="original_path" select="document(resolve-uri('../originalPath.xml', base-uri(/)))/originalPath"/>
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 Kupietz0df2a572024-05-26 16:54:27 +020043 <xsl:copy-of select="doc($dnbBookdataQuery)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010044 </xsl:variable>
45
46 <xsl:variable name="autor"
Marc Kupietzde2ca532024-04-26 16:50:53 +020047 select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietzeaa90132024-04-26 18:14:40 +020048 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
49 <xsl:variable name="translator"
50 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
51 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010052
Marc Kupietz15e7d612024-04-26 18:16:39 +020053 <xsl:variable name="herausgeber"
54 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
55 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010056
57 <xsl:variable name="ina"/>
58 <xsl:variable name="_corpus"/>
59 <xsl:variable name="ent_known"/>
60
61
62 <!-- added HLU 2012-02-09: -->
63 <xsl:variable name="ent">
64 <xsl:choose>
65 <xsl:when test="$ent_known">
66 <xsl:value-of select="$ent_known"/>
67 </xsl:when>
68 <xsl:when test="$ev">
69 <xsl:value-of select="$ev"/>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:value-of select="$j"/>
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:variable>
76
77 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020078 <xsl:variable name="title-with-subtitles">
79 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020080 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
Marc Kupietz744d30e2024-09-22 12:49:45 +020081 <xsl:choose>
82 <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')">
83 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
87 </xsl:otherwise>
88 </xsl:choose>
Marc Kupietz49124fa2024-04-10 16:50:01 +020089 </xsl:when>
90 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020091 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020092 </xsl:otherwise>
93 </xsl:choose>
94 </xsl:variable>
95 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010096 </xsl:variable>
97
98 <xsl:variable name="erscheinungsort">
99 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200100 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
101 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100102 </xsl:when>
103 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200104 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100105 </xsl:otherwise>
106 </xsl:choose>
107 </xsl:variable>
108
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200109 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
110
Marc Kupietz6cb52232024-04-13 12:28:44 +0200111 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100112
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200113 <xsl:variable name="genretable">
114 <genres>
Nicolas Arnold32118802024-05-31 17:10:05 +0200115 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
116 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
117 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200118 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
119 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200120 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
121 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200122 <genre keyRegex="western" genre="Roman: Westernroman"/>
123 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200124 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
125 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
126 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
127 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
128 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
129 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200130 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
Nicolas Arnold32118802024-05-31 17:10:05 +0200131 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL -->
132 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200133 <genre keyRegex="erzählung" genre="Erzählung"/>
134 <genre keyRegex="novelle" genre="Novelle"/>
135 <genre keyRegex="anthologie" genre="Anthologie"/>
136 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200137 <genre keyRegex="geschichte" genre="Erzählung"/>
138 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200139 <genre keyRegex="roman" genre="Roman"/>
140 <genre keyRegex="." genre="Roman"/>
141 </genres>
142 </xsl:variable>
143
144 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100145 <xsl:variable name="verlag">
146 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200147 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
148 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100149 </xsl:when>
150 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200151 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100152 </xsl:otherwise>
153 </xsl:choose>
154 </xsl:variable>
155
156 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200157 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100158 </xsl:variable>
159
160 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +0200161 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100162
Marc Kupietza5d01182024-04-14 12:24:02 +0200163 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100164
165 <!-- for BOT+s: -->
166 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
167
168 <!-- fuer BOT+b: -->
169 <xsl:variable name="_b">
170 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
171 <xsl:choose>
172 <xsl:when test="matches($dnbBookdata, $regexp1)">
173 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
174 <xsl:matching-substring>
175 <xsl:value-of select="."/>
176 </xsl:matching-substring>
177 </xsl:analyze-string>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:value-of select="'.'"/>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:variable>
184
185 <!-- for BOT+x: -->
186 <xsl:variable name="txtart">
187 <xsl:choose>
188 <xsl:when test="$x">
189 <xsl:value-of select="concat('[', $x, ']')"/>
190 </xsl:when>
191 <xsl:when
Nicolas Arnold26355632024-05-10 15:25:41 +0200192 test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100193 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200194 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 +0100195 />
196 </xsl:when>
197 <xsl:otherwise>
198 <xsl:value-of>Roman</xsl:value-of>
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:variable>
202
203
204
205 <!-- fuer BOTd: -->
206 <xsl:variable name="dok"
207 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
208
209 <!-- END variables derived from sru request to dnb archive -->
210
211
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200212 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100213
214 <!-- for BOTD: -->
215 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
216 <xsl:variable name="doc_sigle">
217 <xsl:variable name="firstContentWordTitleInitial">
218 <xsl:variable name="helper">
219 <xsl:analyze-string select="$titel" regex="\w+">
220 <xsl:matching-substring>
221 <xsl:choose>
222 <xsl:when
Marc Kupietzad1f3b82024-04-19 19:21:49 +0200223 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 +0100224 <!-- TODO: Fktnswoerter nachtragen -->
225 <xsl:sequence select="."/>
226 </xsl:when>
227 <xsl:otherwise/>
228 </xsl:choose>
229 </xsl:matching-substring>
230 </xsl:analyze-string>
231 </xsl:variable>
232 <xsl:value-of
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200233 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100234 <!-- longest match of .+ -->
235 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200236 <xsl:variable name="authorInitials">
237 <xsl:choose>
238 <xsl:when test="contains($autor,';')">
239 <xsl:variable name="lastname_aut1"
240 select="upper-case(substring(normalize-space($autor),1,1))"/>
241 <xsl:variable name="lastname_aut2"
242 select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
243 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
244 </xsl:when>
245 <xsl:otherwise>
246 <xsl:variable name="lastname_aut1"
247 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
248 <xsl:variable name="firstname_aut1"
249 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
250 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
251 </xsl:otherwise>
252 </xsl:choose>
253 </xsl:variable>
Marc Kupietz398b5962024-04-21 17:51:34 +0200254 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100255 </xsl:variable>
256
257
Marc Kupietz0c246632024-04-29 07:08:23 +0200258 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100259 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
260
261 <!-- fuer BOT+xy: (?) -->
262 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200263 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100264 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200265 <xsl:text>IDNO:</xsl:text>
266 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100267 <xsl:text>; </xsl:text>
268 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
269 </xsl:variable>
270
Marc Kupietzb660ed62024-03-16 11:45:53 +0100271 <xsl:variable name="long-reference"
272 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
273
274 <xsl:variable name="short-reference"
275 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100276
277 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200278 <!-- for debugging purposes
279 <xsl:message select="concat('uri: ', base-uri())"/>
280 <xsl:message select="concat('idno: ', $idno)"/>
281
282 <xsl:message>
283 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
284 </xsl:message>
285
286 <xsl:message>
287 <xsl:copy-of select="$dnbBookdata"/>
288 </xsl:message>
289 -->
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200290 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200291 <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 +0200292 </xsl:if>
293
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200294 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200295 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200296 </xsl:if>
297
Marc Kupietz2badfb12024-04-19 12:59:40 +0200298 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200299 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200300 </xsl:if>
301
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200302 <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 +0200303 <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 +0200304 </xsl:if>
305
Marc Kupietz1a422662024-03-16 09:34:10 +0100306 <idsDoc TEIform="TEI.2" type="text" version="1.0">
307 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
308 <fileDesc>
309 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100310 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
311 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100312 </titleStmt>
313 <publicationStmt>
314 <distributor/>
315 <pubAddress/>
316 <availability region="world" status="unknown">QAO-NC</availability>
317 <pubDate/>
318 </publicationStmt>
319 <sourceDesc>
320 <biblStruct>
321 <monogr>
322 <h.title type="main"/>
323 <imprint/>
324 </monogr>
325 </biblStruct>
326 </sourceDesc>
327 </fileDesc>
328 </idsHeader>
329 <idsText version="1.0">
330 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
331 <fileDesc>
332 <titleStmt>
333 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100334 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100335 </titleStmt>
336 <publicationStmt>
337 <distributor/>
338 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200339 <xsl:for-each select="$dnbBookdata//dc:identifier">
340 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
341 <xsl:choose>
342 <xsl:when test="@xsi:type='tel:ISBN'">
343 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
344 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
345 </xsl:if>
346 </xsl:when>
Marc Kupietz7582d572024-07-25 16:55:20 +0200347 <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')">
348 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200349 </xsl:when>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200350 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
351 </xsl:choose>
352 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100353 <availability region="world" status="unknown">QAO-NC</availability>
354 <pubDate/>
355 </publicationStmt>
356 <sourceDesc>
357 <biblStruct>
358 <monogr>
359 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
360 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
361 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200362 <xsl:if test="$translator">
363 <editor role="translator"><xsl:value-of select="$translator"/></editor>
364 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200365 <xsl:if test="$herausgeber">
366 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
367 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100368 <edition>
369 <further/>
370 <kind>E-Book-Ausgabe</kind>
371 <appearance>EPUB-Datei</appearance>
372 </edition>
373 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100374 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100375 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
376 <pubDate type="month"/>
377 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200378 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100379 </imprint>
380 <biblScope type="subsume"/>
381 <biblScope type="pp"/>
382 <biblScope type="vol"/>
383 <biblScope type="volume-title"/>
384 </monogr>
Rebecca Wilm2f345ff2024-07-30 16:58:25 +0200385 <xsl:if test="matches($original_path, 'Buchpreis', 'i')">
386 <xsl:variable name="bookprize_year" as="xs:string" select="replace($original_path, '.*Buchpreis_?([0-9]{4}).*' , '$1')"/>
387 <xsl:element name="note">
388 <xsl:attribute name="type">award</xsl:attribute>
389 <xsl:attribute name="subtype">
390 <xsl:value-of select="concat('Deutscher Buchpreis ', $bookprize_year)"/>
391 </xsl:attribute>
392 </xsl:element>
393 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100394 </biblStruct>
395 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100396 </sourceDesc>
397 </fileDesc>
398 <profileDesc>
399 <creation>
400 <creatDate><xsl:value-of select="$j"/></creatDate>
401 </creation>
402 <textClass/>
403 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200404 <textType><xsl:value-of select="$textFullGenre"/></textType>
405 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100406 <textDomain/>
407 </textDesc>
408 </profileDesc>
409 </idsHeader>
410 <text>
411 <body>
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200412 <!-- Call the template for each idref the spine -->
413 <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100414 </body>
415 </text>
416 </idsText>
417 </idsDoc>
418 </xsl:template>
419
Marc Kupietz6b6d4702024-09-12 17:54:10 +0200420 <xsl:template match="opf:itemref" mode="collect">
421 <xsl:variable name="id" select="@idref"/>
422 <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).*'))]"/>
423
424 <xsl:choose>
425 <xsl:when test = "$item">
426 <xsl:variable name="href" select="$item/@href"/>
427 <xsl:if test="$debug">
428 <xsl:message>
429 <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"/>
430 </xsl:message>
431 </xsl:if>
432 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
433 </xsl:when>
434 <xsl:otherwise>
435 <xsl:if test="$debug">
436 <xsl:message>
437 <xsl:text>skipping: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
438 </xsl:message>
439 </xsl:if>
440 </xsl:otherwise>
441 </xsl:choose>
442 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100443
444 <xsl:template match="xhtml:body">
445 <div type="chapter">
446 <xsl:apply-templates/>
447 </div>
448 </xsl:template>
449
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000450 <xsl:template match="xhtml:body/text()">
451 <p>
452 <xsl:value-of select="."/>
453 </p>
454 </xsl:template>
455
Marc Kupietz1a422662024-03-16 09:34:10 +0100456 <xsl:template match="xhtml:title">
457 <head>
458 <xsl:apply-templates/>
459 </head>
460 </xsl:template>
461
462 <xsl:template match="xhtml:h1">
463 <head>
464 <xsl:apply-templates/>
465 </head>
466 </xsl:template>
467
Marc Kupietz3989c742024-04-21 17:33:49 +0200468 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100469 <head type="sub">
470 <xsl:apply-templates/>
471 </head>
472 </xsl:template>
473
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100474 <xsl:template match="xhtml:em">
475 <emph>
476 <xsl:apply-templates/>
477 </emph>
478 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100479
Marc Kupietz30cc0802024-04-10 16:37:04 +0200480 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
481 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
482 <hi rend="{$class}">
483 <xsl:apply-templates/>
484 </hi>
485 </xsl:template>
486
Marc Kupietzad4d4462024-04-26 17:43:08 +0200487 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200488 <xsl:apply-templates/>
489 </xsl:template>
490
Marc Kupietz3989c742024-04-21 17:33:49 +0200491 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200492 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100493 <xsl:apply-templates/>
494 </hi>
495 </xsl:template>
496
Nicolas Arnoldc169e832024-06-07 08:44:11 +0200497 <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 +0000498 <hi rend="italic">
499 <xsl:apply-templates/>
500 </hi>
501 </xsl:template>
502
503
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100504 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100505 <hi rend="sub">
506 <xsl:apply-templates/>
507 </hi>
508 </xsl:template>
509
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100510 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100511 <hi rend="sup">
512 <xsl:apply-templates/>
513 </hi>
514 </xsl:template>
515
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000516 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100517
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200518 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
519 <xsl:apply-templates/>
520 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000521 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100522 <p>
523 <xsl:apply-templates/>
524 </p>
525 </xsl:template>
526
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000527 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
528 <div type="section">
529 <xsl:apply-templates/>
530 </div>
531 </xsl:template>
532
533 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
534 <div type="section">
535 <p>
536 <xsl:apply-templates/>
537 </p>
538 </div>
539 </xsl:template>
540
541 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
542 <xsl:if test="normalize-space(.)">
543 <p>
544 <xsl:apply-templates/>
545 </p>
546 </xsl:if>
547 </xsl:template>
548
549 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
550 <xsl:if test="normalize-space(.)">
551 <div type="section">
552 <xsl:apply-templates/>
553 </div>
554 </xsl:if>
555 </xsl:template>
556
Marc Kupietz09745e12024-04-21 12:54:10 +0200557 <xsl:template match="xhtml:ul">
558 <list type="unordered">
559 <xsl:apply-templates/>
560 </list>
561 </xsl:template>
562 <xsl:template match="xhtml:ol">
563 <list type="ordered">
564 <xsl:apply-templates/>
565 </list>
566 </xsl:template>
567 <xsl:template match="xhtml:li">
568 <item>
569 <xsl:apply-templates/>
570 </item>
571 </xsl:template>
572 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200573 <!-- <gap reason="toc"/> -->
574 </xsl:template>
575
Marc Kupietz1a422662024-03-16 09:34:10 +0100576 <xsl:template match="xhtml:img">
577 <!-- <gap reason="image"/> -->
578 </xsl:template>
579
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200580 <xsl:template match="xhtml:audio">
581 <!-- <gap reason="audio"/> -->
582 </xsl:template>
583
Marc Kupietz09745e12024-04-21 12:54:10 +0200584 <xsl:template match="xhtml:table">
585 <!-- <gap reason="table"/> -->
586 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000587 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200588 <xsl:if test="normalize-space(.)">
589 <p>
590 <ref target="{@href}">
591 <xsl:apply-templates />
592 </ref>
593 </p>
594 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000595 </xsl:template>
596
597 <xsl:template match="xhtml:body/xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200598 <xsl:if test="$debug">
599 <xsl:message>
600 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
601 </xsl:message>
602 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000603 <div type="section">
604 <p>
605 <xsl:value-of select="."/>
606 </p>
607 </div>
608 </xsl:template>
609 <xsl:template match="xhtml:span">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200610 <xsl:if test="$debug">
611 <xsl:message>
612 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
613 </xsl:message>
614 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000615 <xsl:value-of select="."/>
616 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100617 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200618 <xsl:if test="normalize-space(.)">
619 <ref target="{@href}">
620 <xsl:apply-templates />
621 </ref>
622 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100623 </xsl:template>
624
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200625 <xsl:template match="xhtml:br">
626 <lb/><xsl:text>&#10;</xsl:text>
627 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100628
Marc Kupietz1a422662024-03-16 09:34:10 +0100629 <xsl:template match="xhtml:*">
Marc Kupietz7f3fe792024-07-26 15:28:26 +0200630 <xsl:if test="$debug">
631 <xsl:message>
632 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
633 </xsl:message>
634 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000635 <xsl:choose>
636 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
637 <div type="section">
638 <xsl:apply-templates/>
639 </div>
640 </xsl:when>
641 <xsl:otherwise>
642 <xsl:apply-templates select="./*|node()"/>
643 </xsl:otherwise>
644 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100645 <xsl:apply-templates/>
646 </xsl:template>
647
648 <xsl:function name="ids:reversedAuthors">
649 <xsl:param name="s" />
650 <xsl:value-of
651 select="
652 if (matches($s, ';')) then
653 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
654 else
655 replace($s, '(.+) (.+)', '$2, $1')"
656 />
657 </xsl:function>
658
659 <xsl:function name="hlu:reversedAuthors">
660 <xsl:param name="s"/>
661 <xsl:value-of
662 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
663 />
664 </xsl:function>
665
Marc Kupietz10903f32024-04-14 14:21:18 +0200666 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
667 <xsl:map>
668 <xsl:map-entry key="'Axams'" select="'AT'"/>
669 <xsl:map-entry key="'Vienna'" select="'AT'"/>
670 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
671 <xsl:map-entry key="'Graz'" select="'AT'"/>
672 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
673 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
674 <xsl:map-entry key="'Bern'" select="'CH'"/>
675 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
676 <xsl:map-entry key="'Zurich'" select="'CH'"/>
677 <xsl:map-entry key="'Basel'" select="'CH'"/>
678 <xsl:map-entry key="'Geneva'" select="'CH'"/>
679 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
680 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
681 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
682 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
683 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
684 <xsl:map-entry key="'Brussels'" select="'BE'"/>
685 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
686 <xsl:map-entry key="'Ghent'" select="'BE'"/>
687 <xsl:map-entry key="'Bruges'" select="'BE'"/>
688 <xsl:map-entry key="'Leuven'" select="'BE'"/>
689 <xsl:map-entry key="'Liege'" select="'BE'"/>
690 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
691 <xsl:map-entry key="'Namur'" select="'BE'"/>
692 <xsl:map-entry key="'Mons'" select="'BE'"/>
693 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
694 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
695 <xsl:map-entry key="'colatina'" select="'BR'"/>
696 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
697 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
698 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
699 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
700 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
701 <xsl:map-entry key="'Victoria'" select="'CA'"/>
702 <xsl:map-entry key="'Wien'" select="'AT'"/>
703 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
704 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
705 <xsl:map-entry key="'Zürich'" select="'CH'"/>
706 <xsl:map-entry key="'Zug'" select="'CH'"/>
707 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
708 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200709
Marc Kupietz10903f32024-04-14 14:21:18 +0200710 </xsl:variable>
711
712 <!-- Define the function -->
713 <xsl:function name="ids:country-city" as="xs:string">
714 <xsl:param name="city" as="xs:string"/>
715 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
716 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100717</xsl:stylesheet>