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