blob: d83e778d0014fd844d592468502fd016662b0b80 [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
Nicolas Arnold1fbd37f2024-06-28 15:10:47 +0200291 <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 +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/>
305 <availability region="world" status="unknown">QAO-NC</availability>
306 <pubDate/>
307 </publicationStmt>
308 <sourceDesc>
309 <biblStruct>
310 <monogr>
311 <h.title type="main"/>
312 <imprint/>
313 </monogr>
314 </biblStruct>
315 </sourceDesc>
316 </fileDesc>
317 </idsHeader>
318 <idsText version="1.0">
319 <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1">
320 <fileDesc>
321 <titleStmt>
322 <textSigle><xsl:sequence select="$sigle"/></textSigle>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100323 <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title>
Marc Kupietz1a422662024-03-16 09:34:10 +0100324 </titleStmt>
325 <publicationStmt>
326 <distributor/>
327 <pubAddress/>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200328 <xsl:for-each select="$dnbBookdata//dc:identifier">
329 <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/>
330 <xsl:choose>
331 <xsl:when test="@xsi:type='tel:ISBN'">
332 <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')">
333 <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno>
334 </xsl:if>
335 </xsl:when>
Marc Kupietz7582d572024-07-25 16:55:20 +0200336 <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')">
337 <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno>
Marc Kupietzc4ea4092024-07-25 11:00:00 +0200338 </xsl:when>
Rebecca Wilm7bb2b6f2024-06-17 10:34:47 +0200339 <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise>
340 </xsl:choose>
341 </xsl:for-each>
Marc Kupietz1a422662024-03-16 09:34:10 +0100342 <availability region="world" status="unknown">QAO-NC</availability>
343 <pubDate/>
344 </publicationStmt>
345 <sourceDesc>
346 <biblStruct>
347 <monogr>
348 <h.title type="main"><xsl:value-of select="$titel"/></h.title>
349 <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title>
350 <h.author><xsl:value-of select="$autor"/></h.author>
Marc Kupietzeaa90132024-04-26 18:14:40 +0200351 <xsl:if test="$translator">
352 <editor role="translator"><xsl:value-of select="$translator"/></editor>
353 </xsl:if>
Marc Kupietz15e7d612024-04-26 18:16:39 +0200354 <xsl:if test="$herausgeber">
355 <editor role="editor"><xsl:value-of select="$herausgeber"/></editor>
356 </xsl:if>
Marc Kupietz1a422662024-03-16 09:34:10 +0100357 <edition>
358 <further/>
359 <kind>E-Book-Ausgabe</kind>
360 <appearance>EPUB-Datei</appearance>
361 </edition>
362 <imprint>
Marc Kupietzb660ed62024-03-16 11:45:53 +0100363 <publisher><xsl:value-of select="$verlag"/></publisher>
Marc Kupietz1a422662024-03-16 09:34:10 +0100364 <pubDate type="year"><xsl:value-of select="$j"/></pubDate>
365 <pubDate type="month"/>
366 <pubDate type="day"/>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200367 <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace>
Marc Kupietz1a422662024-03-16 09:34:10 +0100368 </imprint>
369 <biblScope type="subsume"/>
370 <biblScope type="pp"/>
371 <biblScope type="vol"/>
372 <biblScope type="volume-title"/>
373 </monogr>
374 </biblStruct>
375 <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference>
Marc Kupietz1a422662024-03-16 09:34:10 +0100376 </sourceDesc>
377 </fileDesc>
378 <profileDesc>
379 <creation>
380 <creatDate><xsl:value-of select="$j"/></creatDate>
381 </creation>
382 <textClass/>
383 <textDesc>
Marc Kupietz9d87e9d2024-05-05 15:56:50 +0200384 <textType><xsl:value-of select="$textFullGenre"/></textType>
385 <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef>
Marc Kupietz1a422662024-03-16 09:34:10 +0100386 <textDomain/>
387 </textDesc>
388 </profileDesc>
389 </idsHeader>
390 <text>
391 <body>
392 <!-- Call the template for each link in the TOC
393 <xsl:apply-templates select="//xhtml:ol[@class='toc']/xhtml:li/xhtml:a" mode="collect"/> -->
Nicolas Arnoldc1c30832024-06-19 12:22:39 +0200394 <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 +0100395 </body>
396 </text>
397 </idsText>
398 </idsDoc>
399 </xsl:template>
400
401 <xsl:template match="opf:item" mode="collect">
402 <xsl:variable name="href" select="@href"/>
403 <xsl:message>
Marc Kupietz0c246632024-04-29 07:08:23 +0200404 <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 +0100405 </xsl:message>
406 <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/>
407 </xsl:template>
408
409 <xsl:template match="xhtml:body">
410 <div type="chapter">
411 <xsl:apply-templates/>
412 </div>
413 </xsl:template>
414
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000415 <xsl:template match="xhtml:body/text()">
416 <p>
417 <xsl:value-of select="."/>
418 </p>
419 </xsl:template>
420
Marc Kupietz1a422662024-03-16 09:34:10 +0100421 <xsl:template match="xhtml:title">
422 <head>
423 <xsl:apply-templates/>
424 </head>
425 </xsl:template>
426
427 <xsl:template match="xhtml:h1">
428 <head>
429 <xsl:apply-templates/>
430 </head>
431 </xsl:template>
432
Marc Kupietz3989c742024-04-21 17:33:49 +0200433 <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6">
Marc Kupietz1a422662024-03-16 09:34:10 +0100434 <head type="sub">
435 <xsl:apply-templates/>
436 </head>
437 </xsl:template>
438
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100439 <xsl:template match="xhtml:em">
440 <emph>
441 <xsl:apply-templates/>
442 </emph>
443 </xsl:template>
Marc Kupietz1a422662024-03-16 09:34:10 +0100444
Marc Kupietz30cc0802024-04-10 16:37:04 +0200445 <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]">
446 <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/>
447 <hi rend="{$class}">
448 <xsl:apply-templates/>
449 </hi>
450 </xsl:template>
451
Marc Kupietzad4d4462024-04-26 17:43:08 +0200452 <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]">
Marc Kupietz5e873112024-04-15 06:51:08 +0200453 <xsl:apply-templates/>
454 </xsl:template>
455
Marc Kupietz3989c742024-04-21 17:33:49 +0200456 <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong">
Marc Kupietz30cc0802024-04-10 16:37:04 +0200457 <hi rend="bold">
Marc Kupietz1a422662024-03-16 09:34:10 +0100458 <xsl:apply-templates/>
459 </hi>
460 </xsl:template>
461
Nicolas Arnoldc169e832024-06-07 08:44:11 +0200462 <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 +0000463 <hi rend="italic">
464 <xsl:apply-templates/>
465 </hi>
466 </xsl:template>
467
468
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100469 <xsl:template match="xhtml:sub|xhtml:span[@class='sub']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100470 <hi rend="sub">
471 <xsl:apply-templates/>
472 </hi>
473 </xsl:template>
474
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100475 <xsl:template match="xhtml:sup|xhtml:span[@class='sup']">
Marc Kupietz1a422662024-03-16 09:34:10 +0100476 <hi rend="sup">
477 <xsl:apply-templates/>
478 </hi>
479 </xsl:template>
480
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000481 <xsl:template match="xhtml:div[not(normalize-space(replace(., '&#160;', ' ')))]" priority="1.0"/>
Marc Kupietz1a422662024-03-16 09:34:10 +0100482
Marc Kupietzbf47ae72024-04-14 14:21:43 +0200483 <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0">
484 <xsl:apply-templates/>
485 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000486 <xsl:template match="xhtml:div/xhtml:div">
Marc Kupietz1a422662024-03-16 09:34:10 +0100487 <p>
488 <xsl:apply-templates/>
489 </p>
490 </xsl:template>
491
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000492 <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]">
493 <div type="section">
494 <xsl:apply-templates/>
495 </div>
496 </xsl:template>
497
498 <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]">
499 <div type="section">
500 <p>
501 <xsl:apply-templates/>
502 </p>
503 </div>
504 </xsl:template>
505
506 <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]">
507 <xsl:if test="normalize-space(.)">
508 <p>
509 <xsl:apply-templates/>
510 </p>
511 </xsl:if>
512 </xsl:template>
513
514 <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]">
515 <xsl:if test="normalize-space(.)">
516 <div type="section">
517 <xsl:apply-templates/>
518 </div>
519 </xsl:if>
520 </xsl:template>
521
Marc Kupietz09745e12024-04-21 12:54:10 +0200522 <xsl:template match="xhtml:ul">
523 <list type="unordered">
524 <xsl:apply-templates/>
525 </list>
526 </xsl:template>
527 <xsl:template match="xhtml:ol">
528 <list type="ordered">
529 <xsl:apply-templates/>
530 </list>
531 </xsl:template>
532 <xsl:template match="xhtml:li">
533 <item>
534 <xsl:apply-templates/>
535 </item>
536 </xsl:template>
537 <xsl:template match="xhtml:nav">
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200538 <!-- <gap reason="toc"/> -->
539 </xsl:template>
540
Marc Kupietz1a422662024-03-16 09:34:10 +0100541 <xsl:template match="xhtml:img">
542 <!-- <gap reason="image"/> -->
543 </xsl:template>
544
Marc Kupietz1e6bfd12024-04-10 16:33:20 +0200545 <xsl:template match="xhtml:audio">
546 <!-- <gap reason="audio"/> -->
547 </xsl:template>
548
Marc Kupietz09745e12024-04-21 12:54:10 +0200549 <xsl:template match="xhtml:table">
550 <!-- <gap reason="table"/> -->
551 </xsl:template>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000552 <xsl:template match="xhtml:body/xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200553 <xsl:if test="normalize-space(.)">
554 <p>
555 <ref target="{@href}">
556 <xsl:apply-templates />
557 </ref>
558 </p>
559 </xsl:if>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000560 </xsl:template>
561
562 <xsl:template match="xhtml:body/xhtml:span">
563 <xsl:message>
564 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
565 </xsl:message>
566 <div type="section">
567 <p>
568 <xsl:value-of select="."/>
569 </p>
570 </div>
571 </xsl:template>
572 <xsl:template match="xhtml:span">
573 <xsl:message>
574 <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
575 </xsl:message>
576 <xsl:value-of select="."/>
577 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100578 <xsl:template match="xhtml:a">
Marc Kupietz164a2832024-04-14 21:00:48 +0200579 <xsl:if test="normalize-space(.)">
580 <ref target="{@href}">
581 <xsl:apply-templates />
582 </ref>
583 </xsl:if>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100584 </xsl:template>
585
Marc Kupietz54ec28b2024-04-27 10:07:06 +0200586 <xsl:template match="xhtml:br">
587 <lb/><xsl:text>&#10;</xsl:text>
588 </xsl:template>
Marc Kupietz99ec04b2024-03-16 11:30:03 +0100589
Marc Kupietz1a422662024-03-16 09:34:10 +0100590 <xsl:template match="xhtml:*">
591 <xsl:message>
592 <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/>
593 </xsl:message>
Marc Kupietz4b1f5952024-04-13 20:04:56 +0000594 <xsl:choose>
595 <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body">
596 <div type="section">
597 <xsl:apply-templates/>
598 </div>
599 </xsl:when>
600 <xsl:otherwise>
601 <xsl:apply-templates select="./*|node()"/>
602 </xsl:otherwise>
603 </xsl:choose>
Marc Kupietz1a422662024-03-16 09:34:10 +0100604 <xsl:apply-templates/>
605 </xsl:template>
606
607 <xsl:function name="ids:reversedAuthors">
608 <xsl:param name="s" />
609 <xsl:value-of
610 select="
611 if (matches($s, ';')) then
612 concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; ')))
613 else
614 replace($s, '(.+) (.+)', '$2, $1')"
615 />
616 </xsl:function>
617
618 <xsl:function name="hlu:reversedAuthors">
619 <xsl:param name="s"/>
620 <xsl:value-of
621 select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')"
622 />
623 </xsl:function>
624
Marc Kupietz10903f32024-04-14 14:21:18 +0200625 <xsl:variable name="city-country-map" as="map(xs:string, xs:string)">
626 <xsl:map>
627 <xsl:map-entry key="'Axams'" select="'AT'"/>
628 <xsl:map-entry key="'Vienna'" select="'AT'"/>
629 <xsl:map-entry key="'Klagenfurt'" select="'AT'"/>
630 <xsl:map-entry key="'Graz'" select="'AT'"/>
631 <xsl:map-entry key="'Innsbruck'" select="'AT'"/>
632 <xsl:map-entry key="'Salzburg'" select="'AT'"/>
633 <xsl:map-entry key="'Bern'" select="'CH'"/>
634 <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/>
635 <xsl:map-entry key="'Zurich'" select="'CH'"/>
636 <xsl:map-entry key="'Basel'" select="'CH'"/>
637 <xsl:map-entry key="'Geneva'" select="'CH'"/>
638 <xsl:map-entry key="'Lucerne'" select="'CH'"/>
639 <xsl:map-entry key="'Lausanne'" select="'CH'"/>
640 <xsl:map-entry key="'Winterthur'" select="'CH'"/>
641 <xsl:map-entry key="'St. Gallen'" select="'CH'"/>
642 <xsl:map-entry key="'Interlaken'" select="'CH'"/>
643 <xsl:map-entry key="'Brussels'" select="'BE'"/>
644 <xsl:map-entry key="'Antwerp'" select="'BE'"/>
645 <xsl:map-entry key="'Ghent'" select="'BE'"/>
646 <xsl:map-entry key="'Bruges'" select="'BE'"/>
647 <xsl:map-entry key="'Leuven'" select="'BE'"/>
648 <xsl:map-entry key="'Liege'" select="'BE'"/>
649 <xsl:map-entry key="'Charleroi'" select="'BE'"/>
650 <xsl:map-entry key="'Namur'" select="'BE'"/>
651 <xsl:map-entry key="'Mons'" select="'BE'"/>
652 <xsl:map-entry key="'Bangkok'" select="'TH'"/>
653 <xsl:map-entry key="'Copenhagen'" select="'DK'"/>
654 <xsl:map-entry key="'colatina'" select="'BR'"/>
655 <xsl:map-entry key="'Oakland Park'" select="'US'"/>
656 <xsl:map-entry key="'Istanbul'" select="'TR'"/>
657 <xsl:map-entry key="'Luxemburg'" select="'LU'"/>
658 <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/>
659 <xsl:map-entry key="'Swakopmund'" select="'NA'"/>
660 <xsl:map-entry key="'Victoria'" select="'CA'"/>
661 <xsl:map-entry key="'Wien'" select="'AT'"/>
662 <xsl:map-entry key="'Windhoek'" select="'NA'"/>
663 <xsl:map-entry key="'Zuerich'" select="'CH'"/>
664 <xsl:map-entry key="'Zürich'" select="'CH'"/>
665 <xsl:map-entry key="'Zug'" select="'CH'"/>
666 <xsl:map-entry key="'ZÜRICH'" select="'CH'"/>
667 </xsl:map>
Marc Kupietzd8599fc2024-04-14 13:16:56 +0200668
Marc Kupietz10903f32024-04-14 14:21:18 +0200669 </xsl:variable>
670
671 <!-- Define the function -->
672 <xsl:function name="ids:country-city" as="xs:string">
673 <xsl:param name="city" as="xs:string"/>
674 <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/>
675 </xsl:function>
Marc Kupietz1a422662024-03-16 09:34:10 +0100676</xsl:stylesheet>