blob: 7e10f9b0c0f227491afe00ee45370dc697b52b56 [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
19 <xsl:variable name="ev"/>
20 <xsl:variable name="x"/>
21
Marc Kupietz0df2a572024-05-26 16:54:27 +020022 <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*' , '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010023
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020024 <xsl:variable name="idno_type">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020025 <xsl:choose>
26 <xsl:when test="starts-with($idno,'1')">
27 <xsl:value-of select="'IDN'"/>
28 </xsl:when>
29 <xsl:otherwise>
30 <xsl:value-of select="'ISBN'"/>
31 </xsl:otherwise>
32 </xsl:choose>
Rebecca Wilmf614a4b2024-05-07 10:19:43 +020033 </xsl:variable>
34
Marc Kupietz0df2a572024-05-26 16:54:27 +020035 <xsl:variable name="dnbBookdataQuery" as="xs:string">
36 <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')"/>
37 </xsl:variable>
Marc Kupietz1a422662024-03-16 09:34:10 +010038 <xsl:variable name="dnbBookdata">
Marc Kupietz0df2a572024-05-26 16:54:27 +020039 <xsl:copy-of select="doc($dnbBookdataQuery)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010040 </xsl:variable>
41
42 <xsl:variable name="autor"
Marc Kupietzde2ca532024-04-26 16:50:53 +020043 select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
Marc Kupietzeaa90132024-04-26 18:14:40 +020044 <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/>
45 <xsl:variable name="translator"
46 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
47 <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010048
Marc Kupietz15e7d612024-04-26 18:16:39 +020049 <xsl:variable name="herausgeber"
50 select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/>
51 <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010052
53 <xsl:variable name="ina"/>
54 <xsl:variable name="_corpus"/>
55 <xsl:variable name="ent_known"/>
56
57
58 <!-- added HLU 2012-02-09: -->
59 <xsl:variable name="ent">
60 <xsl:choose>
61 <xsl:when test="$ent_known">
62 <xsl:value-of select="$ent_known"/>
63 </xsl:when>
64 <xsl:when test="$ev">
65 <xsl:value-of select="$ev"/>
66 </xsl:when>
67 <xsl:otherwise>
68 <xsl:value-of select="$j"/>
69 </xsl:otherwise>
70 </xsl:choose>
71 </xsl:variable>
72
73 <xsl:variable name="titel">
Marc Kupietz49124fa2024-04-10 16:50:01 +020074 <xsl:variable name="title-with-subtitles">
75 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020076 <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')">
Rebecca Wilme5f055a2024-05-10 15:07:50 +020077 <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020078 </xsl:when>
79 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020080 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/>
Marc Kupietz49124fa2024-04-10 16:50:01 +020081 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:variable>
84 <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010085 </xsl:variable>
86
87 <xsl:variable name="erscheinungsort">
88 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +020089 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
90 <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010091 </xsl:when>
92 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +020093 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +010094 </xsl:otherwise>
95 </xsl:choose>
96 </xsl:variable>
97
Marc Kupietzd8599fc2024-04-14 13:16:56 +020098 <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/>
99
Marc Kupietz6cb52232024-04-13 12:28:44 +0200100 <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/>
Marc Kupietz7df4ccc2024-03-16 15:27:45 +0100101
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200102 <xsl:variable name="genretable">
103 <genres>
Nicolas Arnold32118802024-05-31 17:10:05 +0200104 <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/>
105 <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/>
106 <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200107 <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/>
108 <genre keyRegex="horror" genre="Roman: Horrorroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200109 <genre keyRegex="grusel" genre="Roman: Gruselroman"/>
110 <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200111 <genre keyRegex="western" genre="Roman: Westernroman"/>
112 <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200113 <genre keyRegex="mystery" genre="Roman: Mysteryroman"/>
114 <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/>
115 <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/>
116 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/>
117 <genre keyRegex="gay" genre="Roman: Gay-Roman"/>
118 <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200119 <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/>
Nicolas Arnold32118802024-05-31 17:10:05 +0200120 <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL -->
121 <genre keyRegex="(ein roman|der roman)" genre="Roman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200122 <genre keyRegex="erzählung" genre="Erzählung"/>
123 <genre keyRegex="novelle" genre="Novelle"/>
124 <genre keyRegex="anthologie" genre="Anthologie"/>
125 <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/>
Marc Kupietzc214b4c2024-05-26 19:12:03 +0200126 <genre keyRegex="geschichte" genre="Erzählung"/>
127 <genre keyRegex="heftroman" genre="Roman: Heftroman"/>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200128 <genre keyRegex="roman" genre="Roman"/>
129 <genre keyRegex="." genre="Roman"/>
130 </genres>
131 </xsl:variable>
132
133 <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100134 <xsl:variable name="verlag">
135 <xsl:choose>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200136 <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')">
137 <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100138 </xsl:when>
139 <xsl:otherwise>
Marc Kupietz6cb52232024-04-13 12:28:44 +0200140 <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100141 </xsl:otherwise>
142 </xsl:choose>
143 </xsl:variable>
144
145 <xsl:variable name="erscheinungsjahr">
Marc Kupietza5d01182024-04-14 12:24:02 +0200146 <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100147 </xsl:variable>
148
149 <xsl:variable name="untertitel"
Marc Kupietz6cb52232024-04-13 12:28:44 +0200150 select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100151
Marc Kupietza5d01182024-04-14 12:24:02 +0200152 <xsl:variable name="j" select="$erscheinungsjahr"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100153
154 <!-- for BOT+s: -->
155 <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/>
156
157 <!-- fuer BOT+b: -->
158 <xsl:variable name="_b">
159 <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/>
160 <xsl:choose>
161 <xsl:when test="matches($dnbBookdata, $regexp1)">
162 <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}">
163 <xsl:matching-substring>
164 <xsl:value-of select="."/>
165 </xsl:matching-substring>
166 </xsl:analyze-string>
167 </xsl:when>
168 <xsl:otherwise>
169 <xsl:value-of select="'.'"/>
170 </xsl:otherwise>
171 </xsl:choose>
172 </xsl:variable>
173
174 <!-- for BOT+x: -->
175 <xsl:variable name="txtart">
176 <xsl:choose>
177 <xsl:when test="$x">
178 <xsl:value-of select="concat('[', $x, ']')"/>
179 </xsl:when>
180 <xsl:when
Nicolas Arnold26355632024-05-10 15:25:41 +0200181 test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')">
Marc Kupietz1a422662024-03-16 09:34:10 +0100182 <xsl:value-of
Nicolas Arnold26355632024-05-10 15:25:41 +0200183 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 +0100184 />
185 </xsl:when>
186 <xsl:otherwise>
187 <xsl:value-of>Roman</xsl:value-of>
188 </xsl:otherwise>
189 </xsl:choose>
190 </xsl:variable>
191
192
193
194 <!-- fuer BOTd: -->
195 <xsl:variable name="dok"
196 select="concat((if(string-length($autor) &gt; 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/>
197
198 <!-- END variables derived from sru request to dnb archive -->
199
200
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200201 <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100202
203 <!-- for BOTD: -->
204 <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein -->
205 <xsl:variable name="doc_sigle">
206 <xsl:variable name="firstContentWordTitleInitial">
207 <xsl:variable name="helper">
208 <xsl:analyze-string select="$titel" regex="\w+">
209 <xsl:matching-substring>
210 <xsl:choose>
211 <xsl:when
Marc Kupietzad1f3b82024-04-19 19:21:49 +0200212 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 +0100213 <!-- TODO: Fktnswoerter nachtragen -->
214 <xsl:sequence select="."/>
215 </xsl:when>
216 <xsl:otherwise/>
217 </xsl:choose>
218 </xsl:matching-substring>
219 </xsl:analyze-string>
220 </xsl:variable>
221 <xsl:value-of
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200222 select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100223 <!-- longest match of .+ -->
224 </xsl:variable>
Marc Kupietz77b6aa92024-04-21 17:31:43 +0200225 <xsl:variable name="authorInitials">
226 <xsl:choose>
227 <xsl:when test="contains($autor,';')">
228 <xsl:variable name="lastname_aut1"
229 select="upper-case(substring(normalize-space($autor),1,1))"/>
230 <xsl:variable name="lastname_aut2"
231 select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/>
232 <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/>
233 </xsl:when>
234 <xsl:otherwise>
235 <xsl:variable name="lastname_aut1"
236 select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/>
237 <xsl:variable name="firstname_aut1"
238 select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/>
239 <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/>
240 </xsl:otherwise>
241 </xsl:choose>
242 </xsl:variable>
Marc Kupietz398b5962024-04-21 17:51:34 +0200243 <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100244 </xsl:variable>
245
246
Marc Kupietz0c246632024-04-29 07:08:23 +0200247 <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100248 <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/>
249
250 <!-- fuer BOT+xy: (?) -->
251 <xsl:variable name="xyref">
Marc Kupietz0df2a572024-05-26 16:54:27 +0200252 <xsl:value-of select="base-uri(.)"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100253 <xsl:text>; </xsl:text>
Marc Kupietz0c246632024-04-29 07:08:23 +0200254 <xsl:text>IDNO:</xsl:text>
255 <xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100256 <xsl:text>; </xsl:text>
257 <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/>
258 </xsl:variable>
259
Marc Kupietzb660ed62024-03-16 11:45:53 +0100260 <xsl:variable name="long-reference"
261 select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/>
262
263 <xsl:variable name="short-reference"
264 select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100265
266 <xsl:template match="/">
Marc Kupietz98645242024-05-26 16:52:47 +0200267 <!-- for debugging purposes
268 <xsl:message select="concat('uri: ', base-uri())"/>
269 <xsl:message select="concat('idno: ', $idno)"/>
270
271 <xsl:message>
272 dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/>
273 </xsl:message>
274
275 <xsl:message>
276 <xsl:copy-of select="$dnbBookdata"/>
277 </xsl:message>
278 -->
Marc Kupietzb7a4f6c2024-04-19 11:35:25 +0200279 <xsl:if test="not($j)">
Marc Kupietz0c246632024-04-29 07:08:23 +0200280 <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 +0200281 </xsl:if>
282
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200283 <xsl:if test="not(normalize-space($titel))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200284 <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz815cc6c2024-04-19 12:44:44 +0200285 </xsl:if>
286
Marc Kupietz2badfb12024-04-19 12:59:40 +0200287 <xsl:if test="not(normalize-space($autor))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200288 <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message>
Marc Kupietz2badfb12024-04-19 12:59:40 +0200289 </xsl:if>
290
Marc Kupietz52aa5052024-04-21 18:16:06 +0200291 <xsl:if test="not(matches($sigle, '^[A-Z]{3}[0-9]{2}/[A-Z]{2,3}\.[0-9]{5}$'))">
Marc Kupietz0c246632024-04-29 07:08:23 +0200292 <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 +0200293 </xsl:if>
294
Marc Kupietz1a422662024-03-16 09:34:10 +0100295 <idsDoc TEIform="TEI.2" type="text" version="1.0">
296 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1">
297 <fileDesc>
298 <titleStmt>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100299 <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle>
300 <d.title><xsl:value-of select="$short-reference"/></d.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100301 </titleStmt>
302 <publicationStmt>
303 <distributor/>
304 <pubAddress/>
Rebecca Wilme5f055a2024-05-10 15:07:50 +0200305 <xsl:for-each select="$dnbBookdata//dc:identifier">
306 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
307 <xsl:choose>
308 <xsl:when test="@xsi:type='tel:ISBN'">
309 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
310 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
311 </xsl:if>
312 </xsl:when>
313 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
314 </xsl:choose>
315 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100316 <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/>
339 <availability region="world" status="unknown">QAO-NC</availability>
340 <pubDate/>
341 </publicationStmt>
342 <sourceDesc>
343 <biblStruct>
344 <monogr>
345 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
346 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
347 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200348 <xsl:if test="$translator">
349 <editor role="translator"><xsl:value-of select="$translator"/></editor>
350 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200351 <xsl:if test="$herausgeber">
352 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
353 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100354 <edition>
355 <further/>
356 <kind>E-Book-Ausgabe</kind>
357 <appearance>EPUB-Datei</appearance>
358 </edition>
359 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100360 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100361 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
362 <pubDate type="month"/>
363 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200364 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100365 </imprint>
366 <biblScope type="subsume"/>
367 <biblScope type="pp"/>
368 <biblScope type="vol"/>
369 <biblScope type="volume-title"/>
370 </monogr>
371 </biblStruct>
372 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100373 </sourceDesc>
374 </fileDesc>
375 <profileDesc>
376 <creation>
377 <creatDate><xsl:value-of select="$j"/></creatDate>
378 </creation>
379 <textClass/>
380 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200381 <textType><xsl:value-of select="$textFullGenre"/></textType>
382 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100383 <textDomain/>
384 </textDesc>
385 </profileDesc>
386 </idsHeader>
387 <text>
388 <body>
389 <!-- Call the template for each link in the TOC
390 <xsl:apply-templates select="//xhtml:ol[@class='toc']/xhtml:li/xhtml:a" mode="collect"/> -->
Marc Kupietz8f727302024-04-10 16:31:19 +0200391 <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 +0100392 </body>
393 </text>
394 </idsText>
395 </idsDoc>
396 </xsl:template>
397
398 <xsl:template match="opf:item" mode="collect">
399 <xsl:variable name="href" select="@href"/>
400 <xsl:message>
Marc Kupietz0c246632024-04-29 07:08:23 +0200401 <xsl:text>converting: </xsl:text><xsl:value-of select="$href"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100402 </xsl:message>
403 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
404 </xsl:template>
405
406 <xsl:template match="xhtml:body">
407 <div type="chapter">
408 <xsl:apply-templates/>
409 </div>
410 </xsl:template>
411
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000412 <xsl:template match="xhtml:body/text()">
413 <p>
414 <xsl:value-of select="."/>
415 </p>
416 </xsl:template>
417
Marc Kupietz1a422662024-03-16 09:34:10 +0100418 <xsl:template match="xhtml:title">
419 <head>
420 <xsl:apply-templates/>
421 </head>
422 </xsl:template>
423
424 <xsl:template match="xhtml:h1">
425 <head>
426 <xsl:apply-templates/>
427 </head>
428 </xsl:template>
429
Marc Kupietz3989c742024-04-21 17:33:49 +0200430 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100431 <head type="sub">
432 <xsl:apply-templates/>
433 </head>
434 </xsl:template>
435
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100436 <xsl:template match="xhtml:em">
437 <emph>
438 <xsl:apply-templates/>
439 </emph>
440 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100441
Marc Kupietz30cc0802024-04-10 16:37:04 +0200442 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
443 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
444 <hi rend="{$class}">
445 <xsl:apply-templates/>
446 </hi>
447 </xsl:template>
448
Marc Kupietzad4d4462024-04-26 17:43:08 +0200449 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200450 <xsl:apply-templates/>
451 </xsl:template>
452
Marc Kupietz3989c742024-04-21 17:33:49 +0200453 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200454 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100455 <xsl:apply-templates/>
456 </hi>
457 </xsl:template>
458
Marc Kupietzfb0f2c32024-04-26 17:43:18 +0200459 <xsl:template match="xhtml:i|xhtml:span[@class='i' or @class='it']">
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000460 <hi rend="italic">
461 <xsl:apply-templates/>
462 </hi>
463 </xsl:template>
464
465
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100466 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100467 <hi rend="sub">
468 <xsl:apply-templates/>
469 </hi>
470 </xsl:template>
471
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100472 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100473 <hi rend="sup">
474 <xsl:apply-templates/>
475 </hi>
476 </xsl:template>
477
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000478 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100479
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200480 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
481 <xsl:apply-templates/>
482 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000483 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100484 <p>
485 <xsl:apply-templates/>
486 </p>
487 </xsl:template>
488
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000489 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
490 <div type="section">
491 <xsl:apply-templates/>
492 </div>
493 </xsl:template>
494
495 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
496 <div type="section">
497 <p>
498 <xsl:apply-templates/>
499 </p>
500 </div>
501 </xsl:template>
502
503 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
504 <xsl:if test="normalize-space(.)">
505 <p>
506 <xsl:apply-templates/>
507 </p>
508 </xsl:if>
509 </xsl:template>
510
511 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
512 <xsl:if test="normalize-space(.)">
513 <div type="section">
514 <xsl:apply-templates/>
515 </div>
516 </xsl:if>
517 </xsl:template>
518
Marc Kupietz09745e12024-04-21 12:54:10 +0200519 <xsl:template match="xhtml:ul">
520 <list type="unordered">
521 <xsl:apply-templates/>
522 </list>
523 </xsl:template>
524 <xsl:template match="xhtml:ol">
525 <list type="ordered">
526 <xsl:apply-templates/>
527 </list>
528 </xsl:template>
529 <xsl:template match="xhtml:li">
530 <item>
531 <xsl:apply-templates/>
532 </item>
533 </xsl:template>
534 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200535 <!-- <gap reason="toc"/> -->
536 </xsl:template>
537
Marc Kupietz1a422662024-03-16 09:34:10 +0100538 <xsl:template match="xhtml:img">
539 <!-- <gap reason="image"/> -->
540 </xsl:template>
541
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200542 <xsl:template match="xhtml:audio">
543 <!-- <gap reason="audio"/> -->
544 </xsl:template>
545
Marc Kupietz09745e12024-04-21 12:54:10 +0200546 <xsl:template match="xhtml:table">
547 <!-- <gap reason="table"/> -->
548 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000549 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200550 <xsl:if test="normalize-space(.)">
551 <p>
552 <ref target="{@href}">
553 <xsl:apply-templates />
554 </ref>
555 </p>
556 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000557 </xsl:template>
558
559 <xsl:template match="xhtml:body/xhtml:span">
560 <xsl:message>
561 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
562 </xsl:message>
563 <div type="section">
564 <p>
565 <xsl:value-of select="."/>
566 </p>
567 </div>
568 </xsl:template>
569 <xsl:template match="xhtml:span">
570 <xsl:message>
571 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
572 </xsl:message>
573 <xsl:value-of select="."/>
574 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100575 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200576 <xsl:if test="normalize-space(.)">
577 <ref target="{@href}">
578 <xsl:apply-templates />
579 </ref>
580 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100581 </xsl:template>
582
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200583 <xsl:template match="xhtml:br">
584 <lb/><xsl:text>&#10;</xsl:text>
585 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100586
Marc Kupietz1a422662024-03-16 09:34:10 +0100587 <xsl:template match="xhtml:*">
588 <xsl:message>
589 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
590 </xsl:message>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000591 <xsl:choose>
592 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
593 <div type="section">
594 <xsl:apply-templates/>
595 </div>
596 </xsl:when>
597 <xsl:otherwise>
598 <xsl:apply-templates select="./*|node()"/>
599 </xsl:otherwise>
600 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100601 <xsl:apply-templates/>
602 </xsl:template>
603
604 <xsl:function name="ids:reversedAuthors">
605 <xsl:param name="s" />
606 <xsl:value-of
607 select="
608 if (matches($s, ';')) then
609 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
610 else
611 replace($s, '(.+) (.+)', '$2, $1')"
612 />
613 </xsl:function>
614
615 <xsl:function name="hlu:reversedAuthors">
616 <xsl:param name="s"/>
617 <xsl:value-of
618 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
619 />
620 </xsl:function>
621
Marc Kupietz10903f32024-04-14 14:21:18 +0200622 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
623 <xsl:map>
624 <xsl:map-entry key="'Axams'" select="'AT'"/>
625 <xsl:map-entry key="'Vienna'" select="'AT'"/>
626 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
627 <xsl:map-entry key="'Graz'" select="'AT'"/>
628 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
629 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
630 <xsl:map-entry key="'Bern'" select="'CH'"/>
631 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
632 <xsl:map-entry key="'Zurich'" select="'CH'"/>
633 <xsl:map-entry key="'Basel'" select="'CH'"/>
634 <xsl:map-entry key="'Geneva'" select="'CH'"/>
635 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
636 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
637 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
638 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
639 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
640 <xsl:map-entry key="'Brussels'" select="'BE'"/>
641 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
642 <xsl:map-entry key="'Ghent'" select="'BE'"/>
643 <xsl:map-entry key="'Bruges'" select="'BE'"/>
644 <xsl:map-entry key="'Leuven'" select="'BE'"/>
645 <xsl:map-entry key="'Liege'" select="'BE'"/>
646 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
647 <xsl:map-entry key="'Namur'" select="'BE'"/>
648 <xsl:map-entry key="'Mons'" select="'BE'"/>
649 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
650 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
651 <xsl:map-entry key="'colatina'" select="'BR'"/>
652 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
653 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
654 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
655 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
656 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
657 <xsl:map-entry key="'Victoria'" select="'CA'"/>
658 <xsl:map-entry key="'Wien'" select="'AT'"/>
659 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
660 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
661 <xsl:map-entry key="'Zürich'" select="'CH'"/>
662 <xsl:map-entry key="'Zug'" select="'CH'"/>
663 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
664 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200665
Marc Kupietz10903f32024-04-14 14:21:18 +0200666 </xsl:variable>
667
668 <!-- Define the function -->
669 <xsl:function name="ids:country-city" as="xs:string">
670 <xsl:param name="city" as="xs:string"/>
671 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
672 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100673</xsl:stylesheet>