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