| Marc Kupietz | 7cc8fc7 | 2024-05-26 16:49:38 +0200 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 2 | <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 Kupietz | 10903f3 | 2024-04-14 14:21:18 +0200 | [diff] [blame] | 10 | xmlns:map="http://www.w3.org/2005/xpath-functions/map" |
| Rebecca Wilm | e5f055a | 2024-05-10 15:07:50 +0200 | [diff] [blame] | 11 | 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 Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 15 | |
| 16 | <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" saxon:line-length="1000"/> |
| 17 | <xsl:strip-space elements="*"/> |
| 18 | |
| Marc Kupietz | 7f3fe79 | 2024-07-26 15:28:26 +0200 | [diff] [blame] | 19 | <xsl:param name="debug"/> |
| 20 | |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 21 | <xsl:variable name="ev"/> |
| 22 | <xsl:variable name="x"/> |
| Rebecca Wilm | 2f345ff | 2024-07-30 16:58:25 +0200 | [diff] [blame] | 23 | |
| Marc Kupietz | 0df2a57 | 2024-05-26 16:54:27 +0200 | [diff] [blame] | 24 | <xsl:variable name="idno" as="xs:string" select="replace(base-uri(), '.*/([0-9]{9,13}X?).*' , '$1')"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 25 | |
| Rebecca Wilm | f614a4b | 2024-05-07 10:19:43 +0200 | [diff] [blame] | 26 | <xsl:variable name="idno_type"> |
| Rebecca Wilm | e5f055a | 2024-05-10 15:07:50 +0200 | [diff] [blame] | 27 | <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 Wilm | f614a4b | 2024-05-07 10:19:43 +0200 | [diff] [blame] | 35 | </xsl:variable> |
| Rebecca Wilm | 2f345ff | 2024-07-30 16:58:25 +0200 | [diff] [blame] | 36 | |
| Marc Kupietz | 1c3ebca | 2024-09-22 13:49:28 +0200 | [diff] [blame] | 37 | <xsl:param name="buchpreis"/> |
| Rebecca Wilm | f614a4b | 2024-05-07 10:19:43 +0200 | [diff] [blame] | 38 | |
| Marc Kupietz | 0df2a57 | 2024-05-26 16:54:27 +0200 | [diff] [blame] | 39 | <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&operation=searchRetrieve&query=', $idno_type, '%3D', $idno, '&recordSchema=oai_dc')"/> |
| 41 | </xsl:variable> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 42 | <xsl:variable name="dnbBookdata"> |
| Marc Kupietz | 2c7bc7e | 2024-09-30 14:09:25 +0200 | [diff] [blame] | 43 | <xsl:if test="$debug"> |
| 44 | <xsl:message select="concat('debug message dnbBookdataQuery: ', $dnbBookdataQuery)"/> |
| 45 | <xsl:message select="concat('debug message idno: ', $idno)"/> |
| 46 | <xsl:message select="concat('debug message original title from static metadata: ', if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno]//dc:title else '')"/> |
| 47 | </xsl:if> |
| Marc Kupietz | f475f22 | 2024-09-30 15:01:06 +0200 | [diff] [blame] | 48 | <xsl:variable name="tmp" select="if(starts-with($idno, '8')) then doc('static_metadata.xml')//oai:dc[dc:identifier=$idno] else doc($dnbBookdataQuery)"/> |
| 49 | <xsl:copy-of select="if($tmp//dc:title) then $tmp else doc('static_metadata.xml')//oai:dc[replace(dc:identifier[@xsi:type='tel:ISBN'][1], '-', '')=$idno]"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 50 | </xsl:variable> |
| 51 | |
| 52 | <xsl:variable name="autor" |
| Marc Kupietz | de2ca53 | 2024-04-26 16:50:53 +0200 | [diff] [blame] | 53 | select="replace(string-join($dnbBookdata//dc:creator[not(contains(., '[')) or matches(., '\[Verfasser\]')], ' ; '), ' *\[[^\]]*\]', '')"/> |
| Marc Kupietz | eaa9013 | 2024-04-26 18:14:40 +0200 | [diff] [blame] | 54 | <xsl:variable name="straight_autor" select="normalize-space(replace(hlu:reversedAuthors($autor), ',', ''))"/> |
| 55 | <xsl:variable name="translator" |
| 56 | select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[Übersetzer\]')], ' ; '), ' *\[[^\]]*\]', '')"/> |
| 57 | <xsl:variable name="straight_translator" select="normalize-space(replace(hlu:reversedAuthors($translator), ',', ''))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 58 | |
| Marc Kupietz | 15e7d61 | 2024-04-26 18:16:39 +0200 | [diff] [blame] | 59 | <xsl:variable name="herausgeber" |
| 60 | select="replace(string-join($dnbBookdata//dc:creator[matches(., '\[(Herausgeber|Hrsg.)\]')], ' ; '), ' *\[[^\]]*\]', '')"/> |
| 61 | <xsl:variable name="straight_herausgeber" select="normalize-space(replace(hlu:reversedAuthors($herausgeber), ',', ''))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 62 | |
| 63 | <xsl:variable name="ina"/> |
| 64 | <xsl:variable name="_corpus"/> |
| 65 | <xsl:variable name="ent_known"/> |
| 66 | |
| 67 | |
| 68 | <!-- added HLU 2012-02-09: --> |
| 69 | <xsl:variable name="ent"> |
| 70 | <xsl:choose> |
| 71 | <xsl:when test="$ent_known"> |
| 72 | <xsl:value-of select="$ent_known"/> |
| 73 | </xsl:when> |
| 74 | <xsl:when test="$ev"> |
| 75 | <xsl:value-of select="$ev"/> |
| 76 | </xsl:when> |
| 77 | <xsl:otherwise> |
| 78 | <xsl:value-of select="$j"/> |
| 79 | </xsl:otherwise> |
| 80 | </xsl:choose> |
| 81 | </xsl:variable> |
| 82 | |
| 83 | <xsl:variable name="titel"> |
| Marc Kupietz | 49124fa | 2024-04-10 16:50:01 +0200 | [diff] [blame] | 84 | <xsl:variable name="title-with-subtitles"> |
| Marc Kupietz | 2c7bc7e | 2024-09-30 14:09:25 +0200 | [diff] [blame] | 85 | <xsl:if test="$debug"> |
| 86 | <xsl:message select="concat('title: ', ($dnbBookdata//dc:title)[1])"/> |
| 87 | </xsl:if> |
| Marc Kupietz | 49124fa | 2024-04-10 16:50:01 +0200 | [diff] [blame] | 88 | <xsl:choose> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 89 | <xsl:when test="contains(($dnbBookdata//dc:title)[1],':')"> |
| Marc Kupietz | 744d30e | 2024-09-22 12:49:45 +0200 | [diff] [blame] | 90 | <xsl:choose> |
| 91 | <xsl:when test="matches(($dnbBookdata//dc:title)[1], '.*/.*:.*/')"> |
| 92 | <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], ':'))"/> |
| 93 | </xsl:when> |
| 94 | <xsl:otherwise> |
| 95 | <xsl:value-of select="normalize-space(substring-before(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/> |
| 96 | </xsl:otherwise> |
| 97 | </xsl:choose> |
| Marc Kupietz | 49124fa | 2024-04-10 16:50:01 +0200 | [diff] [blame] | 98 | </xsl:when> |
| Marc Kupietz | b990354 | 2024-09-30 14:02:18 +0200 | [diff] [blame] | 99 | <xsl:when test="contains(($dnbBookdata//dc:title)[1],'/')"> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 100 | <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:title)[1], '/'))"/> |
| Marc Kupietz | b990354 | 2024-09-30 14:02:18 +0200 | [diff] [blame] | 101 | </xsl:when> |
| 102 | <xsl:otherwise> |
| 103 | <xsl:value-of select="normalize-space(($dnbBookdata//dc:title)[1])"/> |
| Marc Kupietz | 49124fa | 2024-04-10 16:50:01 +0200 | [diff] [blame] | 104 | </xsl:otherwise> |
| 105 | </xsl:choose> |
| 106 | </xsl:variable> |
| 107 | <xsl:value-of select="normalize-space(replace($title-with-subtitles, '\|.*', ''))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 108 | </xsl:variable> |
| 109 | |
| 110 | <xsl:variable name="erscheinungsort"> |
| 111 | <xsl:choose> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 112 | <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')"> |
| 113 | <xsl:value-of select="normalize-space(substring-before(($dnbBookdata//dc:publisher)[1], ':'))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 114 | </xsl:when> |
| 115 | <xsl:otherwise> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 116 | <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 117 | </xsl:otherwise> |
| 118 | </xsl:choose> |
| 119 | </xsl:variable> |
| 120 | |
| Marc Kupietz | d8599fc | 2024-04-14 13:16:56 +0200 | [diff] [blame] | 121 | <xsl:variable name="erscheinungsland" select="ids:country-city($erscheinungsort)"/> |
| 122 | |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 123 | <xsl:variable name="texttype" select="replace(($dnbBookdata//dc:subject[matches(., '^[A-Z] ')])[1], '^[A-Z] (.*)', '$1')"/> |
| Marc Kupietz | 7df4ccc | 2024-03-16 15:27:45 +0100 | [diff] [blame] | 124 | |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 125 | <xsl:variable name="genretable"> |
| 126 | <genres> |
| Nicolas Arnold | 3211880 | 2024-05-31 17:10:05 +0200 | [diff] [blame] | 127 | <genre keyRegex="(krimi|thriller)" genre="Roman: Kriminalroman"/> |
| 128 | <genre keyRegex="arzt.?roman" genre="Roman: Arztroman"/> |
| 129 | <genre keyRegex="(liebes.*roman|dunja|romanze)" genre="Roman: Liebesroman"/> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 130 | <genre keyRegex="science.?fiction" genre="Roman: Science-Fiction-Roman"/> |
| 131 | <genre keyRegex="horror" genre="Roman: Horrorroman"/> |
| Marc Kupietz | c214b4c | 2024-05-26 19:12:03 +0200 | [diff] [blame] | 132 | <genre keyRegex="grusel" genre="Roman: Gruselroman"/> |
| 133 | <genre keyRegex="vampir.*roman" genre="Roman: Vampirroman"/> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 134 | <genre keyRegex="western" genre="Roman: Westernroman"/> |
| 135 | <genre keyRegex="fantasy" genre="Roman: Fantasyroman"/> |
| Marc Kupietz | c214b4c | 2024-05-26 19:12:03 +0200 | [diff] [blame] | 136 | <genre keyRegex="mystery" genre="Roman: Mysteryroman"/> |
| 137 | <genre keyRegex="heimat.*roman" genre="Roman: Heimatroman"/> |
| 138 | <genre keyRegex="familien.*roman" genre="Roman: Familienroman"/> |
| 139 | <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm).*roman" genre="Roman: Erotikroman"/> |
| 140 | <genre keyRegex="gay" genre="Roman: Gay-Roman"/> |
| 141 | <genre keyRegex="(sex|erotik|erotische|versaute|fick|sm)" genre="Erzählung: Erotikerzählung"/> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 142 | <genre keyRegex="historischer roman" genre="Roman: Historischer Roman"/> |
| Nicolas Arnold | 3211880 | 2024-05-31 17:10:05 +0200 | [diff] [blame] | 143 | <genre keyRegex="jugend" genre="Jugendliteratur: Jugendliteratur"/> <!-- wie in KJL --> |
| 144 | <genre keyRegex="(ein roman|der roman)" genre="Roman"/> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 145 | <genre keyRegex="erzählung" genre="Erzählung"/> |
| 146 | <genre keyRegex="novelle" genre="Novelle"/> |
| 147 | <genre keyRegex="anthologie" genre="Anthologie"/> |
| 148 | <genre keyRegex="kurzgeschichte" genre="Kurzgeschichte"/> |
| Marc Kupietz | c214b4c | 2024-05-26 19:12:03 +0200 | [diff] [blame] | 149 | <genre keyRegex="geschichte" genre="Erzählung"/> |
| 150 | <genre keyRegex="heftroman" genre="Roman: Heftroman"/> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 151 | <genre keyRegex="roman" genre="Roman"/> |
| 152 | <genre keyRegex="." genre="Roman"/> |
| 153 | </genres> |
| 154 | </xsl:variable> |
| 155 | |
| 156 | <xsl:variable name="textFullGenre" select="$genretable/genres/genre[matches($dnbBookdata, ./@keyRegex, 'i')][1]/@genre"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 157 | <xsl:variable name="verlag"> |
| 158 | <xsl:choose> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 159 | <xsl:when test="contains(($dnbBookdata//dc:publisher)[1], ':')"> |
| 160 | <xsl:value-of select="normalize-space(substring-after(($dnbBookdata//dc:publisher)[1], ':'))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 161 | </xsl:when> |
| 162 | <xsl:otherwise> |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 163 | <xsl:value-of select="normalize-space(($dnbBookdata//dc:publisher)[1])"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 164 | </xsl:otherwise> |
| 165 | </xsl:choose> |
| 166 | </xsl:variable> |
| 167 | |
| 168 | <xsl:variable name="erscheinungsjahr"> |
| Marc Kupietz | a5d0118 | 2024-04-14 12:24:02 +0200 | [diff] [blame] | 169 | <xsl:value-of select="replace(($dnbBookdata//dc:date)[1], '.*?((19|20)[0-9][0-9]).*', '$1')"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 170 | </xsl:variable> |
| 171 | |
| 172 | <xsl:variable name="untertitel" |
| Marc Kupietz | 6cb5223 | 2024-04-13 12:28:44 +0200 | [diff] [blame] | 173 | select="normalize-space(substring-after(substring-before(($dnbBookdata//dc:title)[1], '/'), ':'))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 174 | |
| Marc Kupietz | a5d0118 | 2024-04-14 12:24:02 +0200 | [diff] [blame] | 175 | <xsl:variable name="j" select="$erscheinungsjahr"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 176 | |
| 177 | <!-- for BOT+s: --> |
| 178 | <xsl:variable name="seiten" select="replace($dnbBookdata//dc:format,'S\.','')"/> |
| 179 | |
| 180 | <!-- fuer BOT+b: --> |
| 181 | <xsl:variable name="_b"> |
| 182 | <xsl:variable name="regexp1" select="'(Band|Bd\.)\s*([0-9]?[0-9]?[0-9])'"/> |
| 183 | <xsl:choose> |
| 184 | <xsl:when test="matches($dnbBookdata, $regexp1)"> |
| 185 | <xsl:analyze-string select="$dnbBookdata//dc:title" regex="{$regexp1}"> |
| 186 | <xsl:matching-substring> |
| 187 | <xsl:value-of select="."/> |
| 188 | </xsl:matching-substring> |
| 189 | </xsl:analyze-string> |
| 190 | </xsl:when> |
| 191 | <xsl:otherwise> |
| 192 | <xsl:value-of select="'.'"/> |
| 193 | </xsl:otherwise> |
| 194 | </xsl:choose> |
| 195 | </xsl:variable> |
| 196 | |
| 197 | <!-- for BOT+x: --> |
| 198 | <xsl:variable name="txtart"> |
| 199 | <xsl:choose> |
| 200 | <xsl:when test="$x"> |
| 201 | <xsl:value-of select="concat('[', $x, ']')"/> |
| 202 | </xsl:when> |
| 203 | <xsl:when |
| Nicolas Arnold | 2635563 | 2024-05-10 15:25:41 +0200 | [diff] [blame] | 204 | test="matches($untertitel, '([Rr]oman|[Ee]rzählung(en)?|[Aa]nthologie|[Gg]eschichte(n)?|[Nn]ovelle)')"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 205 | <xsl:value-of |
| Nicolas Arnold | 2635563 | 2024-05-10 15:25:41 +0200 | [diff] [blame] | 206 | 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 Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 207 | /> |
| 208 | </xsl:when> |
| 209 | <xsl:otherwise> |
| 210 | <xsl:value-of>Roman</xsl:value-of> |
| 211 | </xsl:otherwise> |
| 212 | </xsl:choose> |
| 213 | </xsl:variable> |
| 214 | |
| 215 | |
| 216 | |
| 217 | <!-- fuer BOTd: --> |
| 218 | <xsl:variable name="dok" |
| 219 | select="concat((if(string-length($autor) > 0) then concat($straight_autor, ': ') else ''), $titel, ', ', $txtart, ', (', $j, ')')"/> |
| 220 | |
| 221 | <!-- END variables derived from sru request to dnb archive --> |
| 222 | |
| 223 | |
| Marc Kupietz | 94bbe6b | 2024-04-10 20:35:48 +0200 | [diff] [blame] | 224 | <xsl:variable name="corpus_sigle" select="concat('DNB', substring($erscheinungsjahr, 3, 2))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 225 | |
| 226 | <!-- for BOTD: --> |
| 227 | <!-- Dokumentsigle muss zusammen mit Korpussigle (z.B DIV fuer loz-div und loz-div-pub) eindeutig sein --> |
| 228 | <xsl:variable name="doc_sigle"> |
| 229 | <xsl:variable name="firstContentWordTitleInitial"> |
| 230 | <xsl:variable name="helper"> |
| 231 | <xsl:analyze-string select="$titel" regex="\w+"> |
| 232 | <xsl:matching-substring> |
| 233 | <xsl:choose> |
| 234 | <xsl:when |
| Marc Kupietz | ad1f3b8 | 2024-04-19 19:21:49 +0200 | [diff] [blame] | 235 | test="matches(.,'^[A-Z]') and not(matches(.,'^(Der|Die|Das|Des|Ein|Eine|Eines|Einmal|Von|Mit|Zu|Zur)$'))"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 236 | <!-- TODO: Fktnswoerter nachtragen --> |
| 237 | <xsl:sequence select="."/> |
| 238 | </xsl:when> |
| 239 | <xsl:otherwise/> |
| 240 | </xsl:choose> |
| 241 | </xsl:matching-substring> |
| 242 | </xsl:analyze-string> |
| 243 | </xsl:variable> |
| 244 | <xsl:value-of |
| Marc Kupietz | 77b6aa9 | 2024-04-21 17:31:43 +0200 | [diff] [blame] | 245 | select="upper-case(substring(normalize-space(replace($helper,'\s+.+$','')),1,3))"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 246 | <!-- longest match of .+ --> |
| 247 | </xsl:variable> |
| Marc Kupietz | 77b6aa9 | 2024-04-21 17:31:43 +0200 | [diff] [blame] | 248 | <xsl:variable name="authorInitials"> |
| 249 | <xsl:choose> |
| 250 | <xsl:when test="contains($autor,';')"> |
| 251 | <xsl:variable name="lastname_aut1" |
| 252 | select="upper-case(substring(normalize-space($autor),1,1))"/> |
| 253 | <xsl:variable name="lastname_aut2" |
| 254 | select="replace($autor, '.*?;.*?([A-Z]).*', '$1')"/> |
| 255 | <xsl:value-of select="concat($lastname_aut1, $lastname_aut2)"/> |
| 256 | </xsl:when> |
| 257 | <xsl:otherwise> |
| 258 | <xsl:variable name="lastname_aut1" |
| 259 | select="upper-case(substring(normalize-space(substring-before($autor,',')),1,1))"/> |
| 260 | <xsl:variable name="firstname_aut1" |
| 261 | select="upper-case(substring(normalize-space(substring-after($autor,',')),1,1))"/> |
| 262 | <xsl:value-of select="concat($lastname_aut1, $firstname_aut1)"/> |
| 263 | </xsl:otherwise> |
| 264 | </xsl:choose> |
| 265 | </xsl:variable> |
| Marc Kupietz | 398b596 | 2024-04-21 17:51:34 +0200 | [diff] [blame] | 266 | <xsl:value-of select="substring(replace(normalize-unicode(concat($authorInitials,$firstContentWordTitleInitial), 'NFKD'),'[^A-Z]',''),1,3)"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 267 | </xsl:variable> |
| 268 | |
| 269 | |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 270 | <xsl:variable name="text_sigle" select="replace($idno, '.*([0-9]{5})[0-9X]$', '$1')"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 271 | <xsl:variable name="sigle" select="concat($corpus_sigle, '/', $doc_sigle, '.', $text_sigle)"/> |
| 272 | |
| 273 | <!-- fuer BOT+xy: (?) --> |
| 274 | <xsl:variable name="xyref"> |
| Marc Kupietz | 0df2a57 | 2024-05-26 16:54:27 +0200 | [diff] [blame] | 275 | <xsl:value-of select="base-uri(.)"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 276 | <xsl:text>; </xsl:text> |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 277 | <xsl:text>IDNO:</xsl:text> |
| 278 | <xsl:value-of select="$idno"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 279 | <xsl:text>; </xsl:text> |
| 280 | <xsl:value-of select="string-join($dnbBookdata//dc:identifier)"/> |
| 281 | </xsl:variable> |
| 282 | |
| Marc Kupietz | b660ed6 | 2024-03-16 11:45:53 +0100 | [diff] [blame] | 283 | <xsl:variable name="long-reference" |
| 284 | select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/> |
| 285 | |
| 286 | <xsl:variable name="short-reference" |
| 287 | select="concat($straight_autor, ': ', $titel, ' (', $erscheinungsjahr, ')')"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 288 | |
| 289 | <xsl:template match="/"> |
| Marc Kupietz | 9864524 | 2024-05-26 16:52:47 +0200 | [diff] [blame] | 290 | <!-- for debugging purposes |
| 291 | <xsl:message select="concat('uri: ', base-uri())"/> |
| 292 | <xsl:message select="concat('idno: ', $idno)"/> |
| 293 | |
| 294 | <xsl:message> |
| 295 | dnbBookdataQuery: <xsl:value-of select="$dnbBookdataQuery"/> |
| 296 | </xsl:message> |
| 297 | |
| 298 | <xsl:message> |
| 299 | <xsl:copy-of select="$dnbBookdata"/> |
| 300 | </xsl:message> |
| 301 | --> |
| Marc Kupietz | 2c7bc7e | 2024-09-30 14:09:25 +0200 | [diff] [blame] | 302 | <xsl:if test="not($dnbBookdata//oai:dc)"> |
| 303 | <xsl:message terminate="yes" default-mode="text">ERROR: No metadata found for IDNO: <xsl:value-of select="$idno"/> |
| 304 | <xsl:text> Query was: </xsl:text> |
| 305 | <xsl:value-of disable-output-escaping="yes" select="replace($dnbBookdataQuery, '&', '%38')"/> |
| 306 | <xsl:text> Retrieved response: </xsl:text> |
| 307 | <xsl:copy-of select="$dnbBookdata"/> |
| 308 | </xsl:message> |
| 309 | </xsl:if> |
| 310 | |
| Marc Kupietz | b7a4f6c | 2024-04-19 11:35:25 +0200 | [diff] [blame] | 311 | <xsl:if test="not($j)"> |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 312 | <xsl:message terminate="yes">ERROR: No dc:date found for IDNO: <xsl:value-of select="$idno"/></xsl:message> |
| Marc Kupietz | b7a4f6c | 2024-04-19 11:35:25 +0200 | [diff] [blame] | 313 | </xsl:if> |
| 314 | |
| Marc Kupietz | 815cc6c | 2024-04-19 12:44:44 +0200 | [diff] [blame] | 315 | <xsl:if test="not(normalize-space($titel))"> |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 316 | <xsl:message terminate="yes">ERROR: No title found for IDNO: <xsl:value-of select="$idno"/></xsl:message> |
| Marc Kupietz | 815cc6c | 2024-04-19 12:44:44 +0200 | [diff] [blame] | 317 | </xsl:if> |
| 318 | |
| Marc Kupietz | 2badfb1 | 2024-04-19 12:59:40 +0200 | [diff] [blame] | 319 | <xsl:if test="not(normalize-space($autor))"> |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 320 | <xsl:message terminate="yes">ERROR: No author found for IDNO: <xsl:value-of select="$idno"/></xsl:message> |
| Marc Kupietz | 2badfb1 | 2024-04-19 12:59:40 +0200 | [diff] [blame] | 321 | </xsl:if> |
| 322 | |
| Nicolas Arnold | 1fbd37f | 2024-06-28 15:10:47 +0200 | [diff] [blame] | 323 | <xsl:if test="not(matches($sigle, '^[A-Z]{2,3}[0-9]{2}/[A-Z]{2,3}\.[0-9]{5}$'))"> |
| Marc Kupietz | 0c24663 | 2024-04-29 07:08:23 +0200 | [diff] [blame] | 324 | <xsl:message terminate="yes">ERROR: Invalid sigle »<xsl:value-of select="$sigle"/>« for IDNO: <xsl:value-of select="$idno"/></xsl:message> |
| Marc Kupietz | 09745e1 | 2024-04-21 12:54:10 +0200 | [diff] [blame] | 325 | </xsl:if> |
| 326 | |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 327 | <idsDoc TEIform="TEI.2" type="text" version="1.0"> |
| 328 | <idsHeader TEIform="teiHeader" pattern="text" status="new" type="document" version="1.1"> |
| 329 | <fileDesc> |
| 330 | <titleStmt> |
| Marc Kupietz | b660ed6 | 2024-03-16 11:45:53 +0100 | [diff] [blame] | 331 | <dokumentSigle><xsl:value-of select="string-join(($corpus_sigle, $doc_sigle), '/')"/></dokumentSigle> |
| 332 | <d.title><xsl:value-of select="$short-reference"/></d.title> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 333 | </titleStmt> |
| 334 | <publicationStmt> |
| 335 | <distributor/> |
| 336 | <pubAddress/> |
| 337 | <availability region="world" status="unknown">QAO-NC</availability> |
| 338 | <pubDate/> |
| 339 | </publicationStmt> |
| 340 | <sourceDesc> |
| 341 | <biblStruct> |
| 342 | <monogr> |
| 343 | <h.title type="main"/> |
| 344 | <imprint/> |
| 345 | </monogr> |
| 346 | </biblStruct> |
| 347 | </sourceDesc> |
| 348 | </fileDesc> |
| 349 | </idsHeader> |
| 350 | <idsText version="1.0"> |
| 351 | <idsHeader TEIform="teiHeader" pattern="text" status="new" type="text" version="1.1"> |
| 352 | <fileDesc> |
| 353 | <titleStmt> |
| 354 | <textSigle><xsl:sequence select="$sigle"/></textSigle> |
| Marc Kupietz | b660ed6 | 2024-03-16 11:45:53 +0100 | [diff] [blame] | 355 | <t.title assemblage="regular"><xsl:value-of select="$long-reference"/></t.title> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 356 | </titleStmt> |
| 357 | <publicationStmt> |
| 358 | <distributor/> |
| 359 | <pubAddress/> |
| Rebecca Wilm | 7bb2b6f | 2024-06-17 10:34:47 +0200 | [diff] [blame] | 360 | <xsl:for-each select="$dnbBookdata//dc:identifier"> |
| 361 | <xsl:variable name="type" select="substring-after(@xsi:type, ':')"/> |
| 362 | <xsl:choose> |
| 363 | <xsl:when test="@xsi:type='tel:ISBN'"> |
| 364 | <xsl:if test="matches(.,'(^([0-9]|-)+X?).*')"> |
| 365 | <idno type="{$type}"><xsl:value-of select="replace(., '(([0-9]|-)+X?).*', '$1')"/></idno> |
| 366 | </xsl:if> |
| 367 | </xsl:when> |
| Marc Kupietz | 7582d57 | 2024-07-25 16:55:20 +0200 | [diff] [blame] | 368 | <xsl:when test="$type='URL' and contains(., '/urn:nbn:de')"> |
| 369 | <idno rend="URN;{tokenize(., '/')[last()]}" type="URL"><xsl:value-of select="."/></idno> |
| Marc Kupietz | c4ea409 | 2024-07-25 11:00:00 +0200 | [diff] [blame] | 370 | </xsl:when> |
| Rebecca Wilm | 7bb2b6f | 2024-06-17 10:34:47 +0200 | [diff] [blame] | 371 | <xsl:otherwise><idno type="{$type}"><xsl:value-of select="."/></idno></xsl:otherwise> |
| 372 | </xsl:choose> |
| 373 | </xsl:for-each> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 374 | <availability region="world" status="unknown">QAO-NC</availability> |
| 375 | <pubDate/> |
| 376 | </publicationStmt> |
| 377 | <sourceDesc> |
| 378 | <biblStruct> |
| 379 | <monogr> |
| 380 | <h.title type="main"><xsl:value-of select="$titel"/></h.title> |
| 381 | <h.title type="sub"><xsl:value-of select="$untertitel"/></h.title> |
| 382 | <h.author><xsl:value-of select="$autor"/></h.author> |
| Marc Kupietz | eaa9013 | 2024-04-26 18:14:40 +0200 | [diff] [blame] | 383 | <xsl:if test="$translator"> |
| 384 | <editor role="translator"><xsl:value-of select="$translator"/></editor> |
| 385 | </xsl:if> |
| Marc Kupietz | 15e7d61 | 2024-04-26 18:16:39 +0200 | [diff] [blame] | 386 | <xsl:if test="$herausgeber"> |
| 387 | <editor role="editor"><xsl:value-of select="$herausgeber"/></editor> |
| 388 | </xsl:if> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 389 | <edition> |
| 390 | <further/> |
| 391 | <kind>E-Book-Ausgabe</kind> |
| 392 | <appearance>EPUB-Datei</appearance> |
| 393 | </edition> |
| 394 | <imprint> |
| Marc Kupietz | b660ed6 | 2024-03-16 11:45:53 +0100 | [diff] [blame] | 395 | <publisher><xsl:value-of select="$verlag"/></publisher> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 396 | <pubDate type="year"><xsl:value-of select="$j"/></pubDate> |
| 397 | <pubDate type="month"/> |
| 398 | <pubDate type="day"/> |
| Marc Kupietz | d8599fc | 2024-04-14 13:16:56 +0200 | [diff] [blame] | 399 | <pubPlace key="{$erscheinungsland}"><xsl:value-of select="$erscheinungsort"/></pubPlace> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 400 | </imprint> |
| 401 | <biblScope type="subsume"/> |
| 402 | <biblScope type="pp"/> |
| 403 | <biblScope type="vol"/> |
| 404 | <biblScope type="volume-title"/> |
| 405 | </monogr> |
| Marc Kupietz | 1c3ebca | 2024-09-22 13:49:28 +0200 | [diff] [blame] | 406 | <xsl:if test="$buchpreis"> |
| Rebecca Wilm | 2f345ff | 2024-07-30 16:58:25 +0200 | [diff] [blame] | 407 | <xsl:element name="note"> |
| 408 | <xsl:attribute name="type">award</xsl:attribute> |
| 409 | <xsl:attribute name="subtype"> |
| Marc Kupietz | e43c720 | 2024-09-22 12:53:41 +0200 | [diff] [blame] | 410 | <xsl:value-of select="'Buchpreis deutscher_buchpreis'"/> |
| Rebecca Wilm | 2f345ff | 2024-07-30 16:58:25 +0200 | [diff] [blame] | 411 | </xsl:attribute> |
| 412 | </xsl:element> |
| 413 | </xsl:if> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 414 | </biblStruct> |
| 415 | <reference assemblage="regular" type="complete"><xsl:value-of select="concat($sigle, ' ', $autor, ': ', $titel, '. ', $erscheinungsort, ': ', $verlag, ', ', $erscheinungsjahr)"/></reference> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 416 | </sourceDesc> |
| 417 | </fileDesc> |
| 418 | <profileDesc> |
| 419 | <creation> |
| 420 | <creatDate><xsl:value-of select="$j"/></creatDate> |
| 421 | </creation> |
| 422 | <textClass/> |
| 423 | <textDesc> |
| Marc Kupietz | 9d87e9d | 2024-05-05 15:56:50 +0200 | [diff] [blame] | 424 | <textType><xsl:value-of select="$textFullGenre"/></textType> |
| 425 | <textTypeRef><xsl:value-of select="replace($textFullGenre, '.*: *', '')"/></textTypeRef> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 426 | <textDomain/> |
| 427 | </textDesc> |
| 428 | </profileDesc> |
| 429 | </idsHeader> |
| 430 | <text> |
| 431 | <body> |
| Marc Kupietz | 6b6d470 | 2024-09-12 17:54:10 +0200 | [diff] [blame] | 432 | <!-- Call the template for each idref the spine --> |
| 433 | <xsl:apply-templates select="//opf:spine/opf:itemref" mode="collect"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 434 | </body> |
| 435 | </text> |
| 436 | </idsText> |
| 437 | </idsDoc> |
| 438 | </xsl:template> |
| 439 | |
| Marc Kupietz | 6b6d470 | 2024-09-12 17:54:10 +0200 | [diff] [blame] | 440 | <xsl:template match="opf:itemref" mode="collect"> |
| 441 | <xsl:variable name="id" select="@idref"/> |
| 442 | <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).*'))]"/> |
| 443 | |
| 444 | <xsl:choose> |
| 445 | <xsl:when test = "$item"> |
| 446 | <xsl:variable name="href" select="$item/@href"/> |
| 447 | <xsl:if test="$debug"> |
| 448 | <xsl:message> |
| 449 | <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"/> |
| 450 | </xsl:message> |
| 451 | </xsl:if> |
| 452 | <xsl:apply-templates select="doc(resolve-uri($href, base-uri()))/xhtml:html/xhtml:body"/> |
| 453 | </xsl:when> |
| 454 | <xsl:otherwise> |
| 455 | <xsl:if test="$debug"> |
| 456 | <xsl:message> |
| 457 | <xsl:text>skipping: </xsl:text><xsl:value-of select="$id"/><xsl:text> </xsl:text><xsl:value-of select="$idno"/> |
| 458 | </xsl:message> |
| 459 | </xsl:if> |
| 460 | </xsl:otherwise> |
| 461 | </xsl:choose> |
| 462 | </xsl:template> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 463 | |
| 464 | <xsl:template match="xhtml:body"> |
| 465 | <div type="chapter"> |
| 466 | <xsl:apply-templates/> |
| 467 | </div> |
| 468 | </xsl:template> |
| 469 | |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 470 | <xsl:template match="xhtml:body/text()"> |
| 471 | <p> |
| 472 | <xsl:value-of select="."/> |
| 473 | </p> |
| 474 | </xsl:template> |
| 475 | |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 476 | <xsl:template match="xhtml:title"> |
| 477 | <head> |
| 478 | <xsl:apply-templates/> |
| 479 | </head> |
| 480 | </xsl:template> |
| 481 | |
| 482 | <xsl:template match="xhtml:h1"> |
| 483 | <head> |
| 484 | <xsl:apply-templates/> |
| 485 | </head> |
| 486 | </xsl:template> |
| 487 | |
| Marc Kupietz | 3989c74 | 2024-04-21 17:33:49 +0200 | [diff] [blame] | 488 | <xsl:template match="xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5|xhtml:h6"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 489 | <head type="sub"> |
| 490 | <xsl:apply-templates/> |
| 491 | </head> |
| 492 | </xsl:template> |
| 493 | |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 494 | <xsl:template match="xhtml:em"> |
| 495 | <emph> |
| 496 | <xsl:apply-templates/> |
| 497 | </emph> |
| 498 | </xsl:template> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 499 | |
| Marc Kupietz | 30cc080 | 2024-04-10 16:37:04 +0200 | [diff] [blame] | 500 | <xsl:template match="xhtml:span[matches(@class, '(bold|italic|big|kursiv| )+')]"> |
| 501 | <xsl:variable name="class" select="replace(@class, 'kursiv', 'italic')"/> |
| 502 | <hi rend="{$class}"> |
| 503 | <xsl:apply-templates/> |
| 504 | </hi> |
| 505 | </xsl:template> |
| 506 | |
| Marc Kupietz | ad4d446 | 2024-04-26 17:43:08 +0200 | [diff] [blame] | 507 | <xsl:template match="xhtml:span[matches(@class, '(regular|norm)')]"> |
| Marc Kupietz | 5e87311 | 2024-04-15 06:51:08 +0200 | [diff] [blame] | 508 | <xsl:apply-templates/> |
| 509 | </xsl:template> |
| 510 | |
| Marc Kupietz | 3989c74 | 2024-04-21 17:33:49 +0200 | [diff] [blame] | 511 | <xsl:template match="xhtml:b|xhtml:span[@class='b']|xhtml:strong"> |
| Marc Kupietz | 30cc080 | 2024-04-10 16:37:04 +0200 | [diff] [blame] | 512 | <hi rend="bold"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 513 | <xsl:apply-templates/> |
| 514 | </hi> |
| 515 | </xsl:template> |
| 516 | |
| Nicolas Arnold | c169e83 | 2024-06-07 08:44:11 +0200 | [diff] [blame] | 517 | <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 Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 518 | <hi rend="italic"> |
| 519 | <xsl:apply-templates/> |
| 520 | </hi> |
| 521 | </xsl:template> |
| 522 | |
| 523 | |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 524 | <xsl:template match="xhtml:sub|xhtml:span[@class='sub']"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 525 | <hi rend="sub"> |
| 526 | <xsl:apply-templates/> |
| 527 | </hi> |
| 528 | </xsl:template> |
| 529 | |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 530 | <xsl:template match="xhtml:sup|xhtml:span[@class='sup']"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 531 | <hi rend="sup"> |
| 532 | <xsl:apply-templates/> |
| 533 | </hi> |
| 534 | </xsl:template> |
| 535 | |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 536 | <xsl:template match="xhtml:div[not(normalize-space(replace(., ' ', ' ')))]" priority="1.0"/> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 537 | |
| Marc Kupietz | bf47ae7 | 2024-04-14 14:21:43 +0200 | [diff] [blame] | 538 | <xsl:template match="xhtml:body/xhtml:div[./xhtml:h1|./xhtml:h2|./xhtml:h3]" priority="1.0"> |
| 539 | <xsl:apply-templates/> |
| 540 | </xsl:template> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 541 | <xsl:template match="xhtml:div/xhtml:div"> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 542 | <p> |
| 543 | <xsl:apply-templates/> |
| 544 | </p> |
| 545 | </xsl:template> |
| 546 | |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 547 | <xsl:template match="xhtml:body/xhtml:div[(descendant::xhtml:p|descendant::xhtml:div)]"> |
| 548 | <div type="section"> |
| 549 | <xsl:apply-templates/> |
| 550 | </div> |
| 551 | </xsl:template> |
| 552 | |
| 553 | <xsl:template match="xhtml:body/xhtml:div[not(descendant::xhtml:p|descendant::xhtml:div)]"> |
| 554 | <div type="section"> |
| 555 | <p> |
| 556 | <xsl:apply-templates/> |
| 557 | </p> |
| 558 | </div> |
| 559 | </xsl:template> |
| 560 | |
| 561 | <xsl:template match="xhtml:p[not(descendant::xhtml:p|descendant::xhtml:div)]"> |
| 562 | <xsl:if test="normalize-space(.)"> |
| 563 | <p> |
| 564 | <xsl:apply-templates/> |
| 565 | </p> |
| 566 | </xsl:if> |
| 567 | </xsl:template> |
| 568 | |
| 569 | <xsl:template match="xhtml:p[descendant::xhtml:p|descendant::xhtml:div]"> |
| 570 | <xsl:if test="normalize-space(.)"> |
| 571 | <div type="section"> |
| 572 | <xsl:apply-templates/> |
| 573 | </div> |
| 574 | </xsl:if> |
| 575 | </xsl:template> |
| 576 | |
| Marc Kupietz | 09745e1 | 2024-04-21 12:54:10 +0200 | [diff] [blame] | 577 | <xsl:template match="xhtml:ul"> |
| 578 | <list type="unordered"> |
| 579 | <xsl:apply-templates/> |
| 580 | </list> |
| 581 | </xsl:template> |
| 582 | <xsl:template match="xhtml:ol"> |
| 583 | <list type="ordered"> |
| 584 | <xsl:apply-templates/> |
| 585 | </list> |
| 586 | </xsl:template> |
| 587 | <xsl:template match="xhtml:li"> |
| 588 | <item> |
| 589 | <xsl:apply-templates/> |
| 590 | </item> |
| 591 | </xsl:template> |
| 592 | <xsl:template match="xhtml:nav"> |
| Marc Kupietz | 1e6bfd1 | 2024-04-10 16:33:20 +0200 | [diff] [blame] | 593 | <!-- <gap reason="toc"/> --> |
| 594 | </xsl:template> |
| 595 | |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 596 | <xsl:template match="xhtml:img"> |
| 597 | <!-- <gap reason="image"/> --> |
| 598 | </xsl:template> |
| 599 | |
| Marc Kupietz | 1e6bfd1 | 2024-04-10 16:33:20 +0200 | [diff] [blame] | 600 | <xsl:template match="xhtml:audio"> |
| 601 | <!-- <gap reason="audio"/> --> |
| 602 | </xsl:template> |
| 603 | |
| Marc Kupietz | 09745e1 | 2024-04-21 12:54:10 +0200 | [diff] [blame] | 604 | <xsl:template match="xhtml:table"> |
| 605 | <!-- <gap reason="table"/> --> |
| 606 | </xsl:template> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 607 | <xsl:template match="xhtml:body/xhtml:a"> |
| Marc Kupietz | 164a283 | 2024-04-14 21:00:48 +0200 | [diff] [blame] | 608 | <xsl:if test="normalize-space(.)"> |
| 609 | <p> |
| 610 | <ref target="{@href}"> |
| 611 | <xsl:apply-templates /> |
| 612 | </ref> |
| 613 | </p> |
| 614 | </xsl:if> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 615 | </xsl:template> |
| 616 | |
| 617 | <xsl:template match="xhtml:body/xhtml:span"> |
| Marc Kupietz | 7f3fe79 | 2024-07-26 15:28:26 +0200 | [diff] [blame] | 618 | <xsl:if test="$debug"> |
| 619 | <xsl:message> |
| 620 | <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/> |
| 621 | </xsl:message> |
| 622 | </xsl:if> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 623 | <div type="section"> |
| 624 | <p> |
| 625 | <xsl:value-of select="."/> |
| 626 | </p> |
| 627 | </div> |
| 628 | </xsl:template> |
| 629 | <xsl:template match="xhtml:span"> |
| Marc Kupietz | 7f3fe79 | 2024-07-26 15:28:26 +0200 | [diff] [blame] | 630 | <xsl:if test="$debug"> |
| 631 | <xsl:message> |
| 632 | <xsl:text>unhandled span element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/> |
| 633 | </xsl:message> |
| 634 | </xsl:if> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 635 | <xsl:value-of select="."/> |
| 636 | </xsl:template> |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 637 | <xsl:template match="xhtml:a"> |
| Marc Kupietz | 164a283 | 2024-04-14 21:00:48 +0200 | [diff] [blame] | 638 | <xsl:if test="normalize-space(.)"> |
| 639 | <ref target="{@href}"> |
| 640 | <xsl:apply-templates /> |
| 641 | </ref> |
| 642 | </xsl:if> |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 643 | </xsl:template> |
| 644 | |
| Marc Kupietz | 54ec28b | 2024-04-27 10:07:06 +0200 | [diff] [blame] | 645 | <xsl:template match="xhtml:br"> |
| 646 | <lb/><xsl:text> </xsl:text> |
| 647 | </xsl:template> |
| Marc Kupietz | 99ec04b | 2024-03-16 11:30:03 +0100 | [diff] [blame] | 648 | |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 649 | <xsl:template match="xhtml:*"> |
| Marc Kupietz | 7f3fe79 | 2024-07-26 15:28:26 +0200 | [diff] [blame] | 650 | <xsl:if test="$debug"> |
| 651 | <xsl:message> |
| 652 | <xsl:text>unhandled element: </xsl:text><xsl:value-of select="concat(name(), ' ', string-join(./@*[normalize-space(.) != '']/concat(name(), ':', ., ' '), '_'))"/> |
| 653 | </xsl:message> |
| 654 | </xsl:if> |
| Marc Kupietz | 4b1f595 | 2024-04-13 20:04:56 +0000 | [diff] [blame] | 655 | <xsl:choose> |
| 656 | <xsl:when test="descendant::xhtml:div|descendant::xhtml:p|parent::xhtml:body"> |
| 657 | <div type="section"> |
| 658 | <xsl:apply-templates/> |
| 659 | </div> |
| 660 | </xsl:when> |
| 661 | <xsl:otherwise> |
| 662 | <xsl:apply-templates select="./*|node()"/> |
| 663 | </xsl:otherwise> |
| 664 | </xsl:choose> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 665 | <xsl:apply-templates/> |
| 666 | </xsl:template> |
| 667 | |
| 668 | <xsl:function name="ids:reversedAuthors"> |
| 669 | <xsl:param name="s" /> |
| 670 | <xsl:value-of |
| 671 | select=" |
| 672 | if (matches($s, ';')) then |
| 673 | concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) |
| 674 | else |
| 675 | replace($s, '(.+) (.+)', '$2, $1')" |
| 676 | /> |
| 677 | </xsl:function> |
| 678 | |
| 679 | <xsl:function name="hlu:reversedAuthors"> |
| 680 | <xsl:param name="s"/> |
| 681 | <xsl:value-of |
| 682 | select="if (matches($s, ';')) then concat(ids:reversedAuthors(substring-before($s, ' ; ')), ' ; ', ids:reversedAuthors(substring-after($s, ' ; '))) else replace($s, '(.+),(.+)', '$2, $1')" |
| 683 | /> |
| 684 | </xsl:function> |
| 685 | |
| Marc Kupietz | 10903f3 | 2024-04-14 14:21:18 +0200 | [diff] [blame] | 686 | <xsl:variable name="city-country-map" as="map(xs:string, xs:string)"> |
| 687 | <xsl:map> |
| 688 | <xsl:map-entry key="'Axams'" select="'AT'"/> |
| 689 | <xsl:map-entry key="'Vienna'" select="'AT'"/> |
| 690 | <xsl:map-entry key="'Klagenfurt'" select="'AT'"/> |
| 691 | <xsl:map-entry key="'Graz'" select="'AT'"/> |
| 692 | <xsl:map-entry key="'Innsbruck'" select="'AT'"/> |
| 693 | <xsl:map-entry key="'Salzburg'" select="'AT'"/> |
| 694 | <xsl:map-entry key="'Bern'" select="'CH'"/> |
| 695 | <xsl:map-entry key="'Biel/Bienne'" select="'CH'"/> |
| 696 | <xsl:map-entry key="'Zurich'" select="'CH'"/> |
| 697 | <xsl:map-entry key="'Basel'" select="'CH'"/> |
| 698 | <xsl:map-entry key="'Geneva'" select="'CH'"/> |
| 699 | <xsl:map-entry key="'Lucerne'" select="'CH'"/> |
| 700 | <xsl:map-entry key="'Lausanne'" select="'CH'"/> |
| 701 | <xsl:map-entry key="'Winterthur'" select="'CH'"/> |
| 702 | <xsl:map-entry key="'St. Gallen'" select="'CH'"/> |
| 703 | <xsl:map-entry key="'Interlaken'" select="'CH'"/> |
| 704 | <xsl:map-entry key="'Brussels'" select="'BE'"/> |
| 705 | <xsl:map-entry key="'Antwerp'" select="'BE'"/> |
| 706 | <xsl:map-entry key="'Ghent'" select="'BE'"/> |
| 707 | <xsl:map-entry key="'Bruges'" select="'BE'"/> |
| 708 | <xsl:map-entry key="'Leuven'" select="'BE'"/> |
| 709 | <xsl:map-entry key="'Liege'" select="'BE'"/> |
| 710 | <xsl:map-entry key="'Charleroi'" select="'BE'"/> |
| 711 | <xsl:map-entry key="'Namur'" select="'BE'"/> |
| 712 | <xsl:map-entry key="'Mons'" select="'BE'"/> |
| 713 | <xsl:map-entry key="'Bangkok'" select="'TH'"/> |
| 714 | <xsl:map-entry key="'Copenhagen'" select="'DK'"/> |
| 715 | <xsl:map-entry key="'colatina'" select="'BR'"/> |
| 716 | <xsl:map-entry key="'Oakland Park'" select="'US'"/> |
| 717 | <xsl:map-entry key="'Istanbul'" select="'TR'"/> |
| 718 | <xsl:map-entry key="'Luxemburg'" select="'LU'"/> |
| 719 | <xsl:map-entry key="'Palma de Mallorca'" select="'ES'"/> |
| 720 | <xsl:map-entry key="'Swakopmund'" select="'NA'"/> |
| 721 | <xsl:map-entry key="'Victoria'" select="'CA'"/> |
| 722 | <xsl:map-entry key="'Wien'" select="'AT'"/> |
| 723 | <xsl:map-entry key="'Windhoek'" select="'NA'"/> |
| 724 | <xsl:map-entry key="'Zuerich'" select="'CH'"/> |
| 725 | <xsl:map-entry key="'Zürich'" select="'CH'"/> |
| 726 | <xsl:map-entry key="'Zug'" select="'CH'"/> |
| 727 | <xsl:map-entry key="'ZÜRICH'" select="'CH'"/> |
| 728 | </xsl:map> |
| Marc Kupietz | d8599fc | 2024-04-14 13:16:56 +0200 | [diff] [blame] | 729 | |
| Marc Kupietz | 10903f3 | 2024-04-14 14:21:18 +0200 | [diff] [blame] | 730 | </xsl:variable> |
| 731 | |
| 732 | <!-- Define the function --> |
| 733 | <xsl:function name="ids:country-city" as="xs:string"> |
| 734 | <xsl:param name="city" as="xs:string"/> |
| 735 | <xsl:sequence select="if (map:contains($city-country-map, $city)) then map:get($city-country-map, $city) else 'DE'"/> |
| 736 | </xsl:function> |
| Marc Kupietz | 1a42266 | 2024-03-16 09:34:10 +0100 | [diff] [blame] | 737 | </xsl:stylesheet> |