Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
503 commits
Select commit Hold shift + click to select a range
e3c1f2a
erg. f. gestr.: del hinter add
dariok Mar 22, 2019
355c01e
actions verallgemeinern
dariok Mar 22, 2019
a771ec6
gestr. umsetzen
dariok Mar 22, 2019
ad21df5
Originaltext in Element verpacken
dariok Mar 22, 2019
3141b2a
orig besser bei 2 actions
dariok Mar 22, 2019
b62b1a9
orig verarbeiten und korr. umsetzen
dariok Mar 22, 2019
22f6d17
rdg mit wit versehen und orig eintragen
dariok Mar 22, 2019
6bc3e85
Person/Quelle besser erstellen
dariok Mar 23, 2019
6f1f517
Korr. im Original mit subst
dariok Mar 23, 2019
51ddf09
Konj.
dariok Mar 23, 2019
bb0445c
Hände: seg mit hand
dariok Mar 23, 2019
8a73f93
source immer als resp-Attribut umsetzen
dariok Mar 23, 2019
7ed2b5b
verbessern von resp
dariok Mar 23, 2019
3b80472
einfaches add umsetzen
dariok Mar 23, 2019
42876d7
subst erzeugen
dariok Mar 23, 2019
05135a7
subst ohne add/place für korr. aus
dariok Mar 23, 2019
684af51
Konj. des Editors
dariok Mar 24, 2019
a8badb4
Umfang des gestrichenen vorbereiten
dariok Mar 24, 2019
16345ca
Tippfehler im Wert für extent
dariok Mar 24, 2019
d60f357
del umsetzen
dariok Mar 24, 2019
9d6c241
andere Hände als seg ausgeben
dariok Mar 24, 2019
5c8f935
Lesarten kopieren
dariok Mar 24, 2019
bc5345f
leeres extent nicht übernehmen
dariok Mar 25, 2019
8b15fc9
Text aus cit in quote überführen
dariok Mar 25, 2019
790f7bf
festes Leerzeichen im pb zu normalem
dariok Mar 25, 2019
fac0ad0
Aus kursivem in rdg wt:orig machen
dariok Mar 25, 2019
6fc3a99
wt:orig zu rdg, otherwise wird wt:note
dariok Mar 25, 2019
a2794c9
wt:note situationsabhängig umsetzen
dariok Mar 25, 2019
a0dcc11
Tippfehler in Auswertung für extent beseitig und Test
dariok Mar 25, 2019
f5117c3
rdg nur erstellen, wenn es tatsächlich etwas gibt
dariok Mar 25, 2019
ac573cc
Anmerkung zusammensetzen, wenn nichts kodierbares
dariok Mar 25, 2019
bace65e
wiederhergestellte note: orig erzeugen für Text
dariok Mar 25, 2019
0ebb206
Verdrehugn bei choice+sic+corr
dariok Mar 25, 2019
1529184
" für quote verarbeiten
dariok Mar 25, 2019
3f9a343
Gruppierung zum quote korrigieren
dariok Mar 25, 2019
7de5e26
Attribute: sequence, Knoten apply
dariok Mar 26, 2019
f6c21a3
letzte Korrekturen
dariok Mar 26, 2019
4ab1051
.
dariok Mar 26, 2019
061b2aa
Link: Inhalt der internen Relationship ignorieren
dariok Apr 8, 2019
0407e5e
weitere relations übernehmen
dariok Apr 8, 2019
ac80e47
RelaxNG eintragen
dariok Apr 9, 2019
070165a
schemaLocation nicht mehr nötig: jetzt RNC
dariok Apr 9, 2019
a6fc3df
RNC eintragen
dariok Apr 9, 2019
3c3351e
Fettes übernehmen
dariok Apr 11, 2019
f7a9d5a
create basic transformation
dariok Apr 15, 2019
1033312
create tei:p from w:p, copy style name
dariok Apr 15, 2019
8e01671
w:r → tei:ab if text()
dariok Apr 15, 2019
81a1c3b
add hex2dec helper
dariok Apr 15, 2019
42bd41d
convert symbols
dariok Apr 15, 2019
685ced0
first try at taking over fields
dariok Apr 15, 2019
864e368
turn w:hpyerlink into a field (like fldChar)
dariok Apr 15, 2019
3e4fc12
place footnotes in situ
dariok Apr 16, 2019
db15f09
endnotes: create ptr and process contents to back
dariok Apr 16, 2019
98e6700
w:tab → tei:space
dariok Apr 16, 2019
417e414
w:pPr should also use contents of child w:rPr
dariok Apr 16, 2019
c7efe97
use both pStyle and rPr in a paragraph’s style
dariok Apr 16, 2019
2db4dd1
do not produce a semivolon-only attribute
dariok Apr 16, 2019
0af3854
turn comment ranges into ptr + note(comment)
dariok Apr 16, 2019
5c2aa8f
more generic file name
dariok Apr 16, 2019
fe9fb98
endnotes: ptr with ref, note with ID
dariok Apr 16, 2019
609d9fc
bookmarks to pointers
dariok Apr 16, 2019
a5d8bdd
adjust bookmark's ptr(ref) to anchor(corresp or ref)
dariok Apr 16, 2019
a0a91db
.
dariok Apr 16, 2019
25a6ba3
combine similar elements (local-name() + att::style)
dariok Apr 16, 2019
f2ff2c5
include an option to apply on base transformation
dariok Apr 17, 2019
a7118b7
remove unused param
dariok Apr 17, 2019
4fa3314
w:tab can occur together with w:t
dariok Apr 17, 2019
c4b1397
take any children from ab when grouping
dariok Apr 17, 2019
14d82f6
use correct title
dariok Jun 19, 2019
b148cc0
short German docu including graphics
dariok Jun 24, 2019
375bd9e
add an example for tasks in XSLTs (German)
dariok Jun 25, 2019
185a4ce
basic transformation for tables
dariok Jul 4, 2019
6caf069
lb nur bei mehreren w:tc/w:p
dariok Jul 4, 2019
5e8927a
create flat OPC from DOCX using Saxon 9.8 + EXPath
dariok Jul 5, 2019
c54d81b
add a check: use function based on Saxon version
dariok Jul 5, 2019
4957626
Transformation scenario for Oxygen
dariok Jul 10, 2019
b159b45
Documentation
dariok Jul 10, 2019
d5e6522
small update to readme to reflect docx.xsl
dariok Jul 10, 2019
0200341
use `use-when` to avoid compiler error
dariok Jul 10, 2019
7269165
TB now in own repo
dariok Jul 16, 2019
1d056bb
remove 2 vars specific to thbw
dariok Oct 1, 2019
57fa5a8
Merge branch 'master' of git@github.com:dariok/w2tei.git
dariok Oct 1, 2019
bbdbc72
tagsDecl für Werte von `@rendition` einfügen
dariok Oct 21, 2019
e8e466b
Merge branch 'master' of https://github.com/dariok/w2tei.git
dariok Oct 21, 2019
23923e8
Create LICENSE
dariok Nov 8, 2019
7ae35e8
extract footnotes.rels.xml, too
dariok Dec 12, 2019
87e3133
Merge branch 'master' of https://github.com/dariok/w2tei.git
dariok Dec 12, 2019
cf47add
start transformation from w:document
dariok Jan 8, 2020
e298a9e
Merge branch 'master' of git@github.com:dariok/w2tei.git
dariok Jan 8, 2020
d7578cf
w:hyperlink to field, URL to att target
dariok Jan 10, 2020
c6bcf84
housekeeping
dariok Jan 10, 2020
cf218e0
include tests with package
dariok Jan 10, 2020
bef947f
return links directly as ref
dariok Jan 10, 2020
3f43e31
post-processing ab
dariok Jan 10, 2020
a29861f
post processing ab: italics
dariok Jan 10, 2020
f10e6d1
post processing ab: default
dariok Jan 10, 2020
0f26947
KS: auf pkg:package umstellen
dariok Jan 13, 2020
b285349
tables for Karlstadt
dariok Jan 14, 2020
5bd59f1
KS: Textmarken (bookmarks) for cross-ref
dariok Jan 22, 2020
ff96571
fline richtig aus neuer Sturktur holen
dariok Jan 25, 2020
00a9fda
hyperlinks mit Verweisen auf Textabschnitte
dariok Jan 25, 2020
3acdf8d
trans-1 und Tests aktualisieren
dariok Jan 25, 2020
d6decec
Intro an pre anpassen.
dariok Jan 26, 2020
f20304e
anchor mit c, q, n
dariok Feb 14, 2020
17c736f
typo
dariok Feb 14, 2020
526a301
anchor cnq übernehmen!
dariok Feb 14, 2020
2f14845
Bibelstellen nach trans-5 verschieben
dariok Mar 3, 2020
0fb793b
Test korrigieren
dariok Mar 3, 2020
4f343f8
Korr t4
dariok Mar 3, 2020
4662c42
Tests korrigieren
dariok Mar 4, 2020
848c323
ref und QV auslagern für Weiterverwendung
dariok Mar 4, 2020
3159c8a
Ref generell
dariok Mar 4, 2020
ea18397
eval
dariok Mar 4, 2020
c71da57
Großschreibung von Text/Intro berücksichtigen
dariok Mar 10, 2020
259a944
Register grdstzl. aus 216 nehmen
dariok Mar 10, 2020
0400710
bibl-Markiewrungen mit 2 Angaben aufteilen
dariok Mar 12, 2020
93217e5
Bei Verlinkung nicht über verweisende bibl in Bibligraphie stolpern
dariok Mar 12, 2020
de19171
generelle Verweise der Form EE123##
dariok Mar 12, 2020
7fe481a
KSEE-Verweis ist Inhalt, kein ambig. rule match
dariok Mar 16, 2020
3f3c609
Anm. vor FN-Verweis entfernen (+ weiterer Test)
dariok Mar 16, 2020
a968ac3
ptr mit Text zu ref
dariok Mar 16, 2020
24796de
Leerzeichen nach bibl erhalten
dariok Mar 16, 2020
f64e2bc
QV aus Text
dariok Mar 16, 2020
f765c0d
Korr. Test Intro
dariok Mar 22, 2020
f99fe69
ignore partial reports
dariok Mar 22, 2020
6994f6e
?
dariok Mar 22, 2020
07c6831
nur bibl mit abbr berücksichtigen
dariok Mar 22, 2020
bcf48f5
documents refs ggf. vor erstem pkg:part
dariok Mar 22, 2020
50106e4
Anm. nicht doppeln, ref verbessern
dariok Mar 22, 2020
e9fe3f8
bibl. Angaben mit ; auftelen
dariok Mar 22, 2020
ba3b711
QV-liuns in Intro verarbeiten
dariok Mar 22, 2020
f64725d
ref und ptr nterscheiden
dariok Mar 22, 2020
096828e
explicitly avoid indentation
dariok Mar 22, 2020
938c5ab
dariok Mar 22, 2020
deffd1a
A comment may contain multiple w:p
dariok Mar 22, 2020
a5451b8
an aktuelle Register anpassen.
dariok Mar 23, 2020
a43106f
Auslassung auch mit …
dariok Mar 23, 2020
49e7732
Varianten von gap mit …
dariok Mar 23, 2020
bffb8b2
Auslassungen mit …
dariok Mar 23, 2020
fd29219
… für gap
dariok Mar 24, 2020
c50716f
Bibelstellenkodierung einheitlich in post.xsl
dariok Mar 24, 2020
4d16f24
adjustments for bookmark-to-pointer
dariok May 19, 2020
edbc4e9
create p ecplicitly
dariok May 19, 2020
a8813ae
merge
dariok May 19, 2020
50ec770
#cc für zentrierte Texte
dariok Jul 1, 2020
19d4cc3
ursprüngliche Art der Trennung wiederherstellen
dariok Jul 1, 2020
4cf5db8
lb hinter pb
dariok Jul 1, 2020
68e2392
lb hinter pb
dariok Jul 1, 2020
802f1c7
bibl nicht mehr an ; aufteilen, um Hochstellung zu übernehmen
dariok Jul 1, 2020
b3f02e6
bibl nicht mehr an ; aufteilen, um Hochstellung zu übernehmen
dariok Jul 1, 2020
f6ca990
Erkennung Text abändern
dariok Jul 6, 2020
e4060e2
Nur zugehörige Kommentare ausgeben
dariok Jul 11, 2020
0b39b8d
extent/hi behalten
dariok Jul 11, 2020
fcfa40d
nur eine Variante von „folgt gestrichen“
dariok Jul 11, 2020
abf7a2f
Word teilt auch sinnlos auf
dariok Jul 11, 2020
41a2991
Ausrichtung rr auch aus w:jc erstellen
dariok Jul 11, 2020
a56e972
weitere Variante für Trennung
dariok Jul 12, 2020
bb17a07
restore param names
dariok Jul 12, 2020
2f2a4b7
split up named paragraph style and single definitions
dariok Nov 23, 2020
5ce61e5
Hyperlinks: do not double link target
dariok Nov 23, 2020
8797610
create lists with labels from numbering information
dariok Nov 23, 2020
dc8136a
convert Word style instructions to CSS
dariok Nov 29, 2020
33817cc
convert vertAlign
dariok Nov 29, 2020
8646e94
w:br → tei:lb
dariok Nov 29, 2020
3d61947
ignore rtl:0 and szCs
dariok Nov 29, 2020
9b02cff
column spanning → cell/@cols
dariok Nov 29, 2020
9b3087e
add scenario OPC→TEI and use variables
dariok Dec 4, 2020
35f7226
omit XML declaration for intermediary steps
dariok Dec 4, 2020
57a21db
bold, italic: also valid, if eq ''
dariok Dec 4, 2020
8afd1f6
replace semicolon in font enum by comma
dariok Dec 4, 2020
f525b24
improve eval of w:r[w:tab]
dariok Dec 5, 2020
7df145a
there may be paragraphs in notes
dariok Dec 5, 2020
fd4f683
improve handling of hyperlinks
dariok Dec 5, 2020
ba1045d
corrections to test
dariok Jan 6, 2021
f55cb66
remove a type that introduced an unwanted ;
dariok Jan 6, 2021
d953bb2
when grouping, take type into account
dariok Jan 6, 2021
a0ea52d
minor changes
dariok Jan 6, 2021
83eac29
evaluate attrib w:cs for font in caps
dariok Jan 8, 2021
aad7928
coherent handling of style information
dariok Jan 8, 2021
9ed14c6
handle small caps
dariok Jan 8, 2021
0a6ddd0
evaluate w:pPr differently
dariok Jan 8, 2021
3682ec8
process paragraph alignment
dariok Jan 8, 2021
2a5486d
include a space after colon in text-align
dariok Jan 9, 2021
be5592f
convert double underline and strikethrough
dariok Jan 11, 2021
ffb6dd1
when converting ab, keep attributes
dariok Jan 11, 2021
dbbfdde
do not evaluate w:pPr/w:rPr
dariok Jan 11, 2021
72daf7e
adjust tests 1 and 2 to changes in w0
dariok Jan 11, 2021
a29d837
produce clean style attributes
dariok Jan 11, 2021
1ea8132
completely forgot to include wt2.xsl
dariok Jan 22, 2021
501788f
Merge branch 'master' of github.com:dariok/w2tei
dariok Jan 22, 2021
651e622
space: use correct attribute unit
dariok Mar 4, 2021
353d46c
Merge branch 'master' of github.com:dariok/w2tei
dariok Mar 4, 2021
20de03d
extract settings.xml from .docx
dariok Mar 27, 2021
162108e
Merge branch 'master' of github.com:dariok/w2tei
dariok Mar 28, 2021
1db76d4
evaluate numbering start value for footnotes
dariok Mar 28, 2021
e3ffb06
preserve tei:div
dariok Mar 28, 2021
187ddd8
grouping styles: also use att rendition for comparison
dariok Mar 28, 2021
fadd809
changes in xml:space handling
dariok Mar 28, 2021
8d9ff7a
adjust tests to reflect changed xml:space handling
dariok Mar 28, 2021
ca01a43
XQL: include settings.xml
dariok Mar 31, 2021
91a4d4d
improve extraction of XML from docx in XQL
dariok Mar 31, 2021
7a29773
remove _GoBack anchors
dariok Apr 13, 2021
0f5a07e
Merge
dariok Apr 13, 2021
46243e2
return numbered headings as heading
dariok Apr 23, 2021
bdba016
table cell borders to style attribute
dariok Apr 25, 2021
b959c75
Merge
dariok Apr 25, 2021
44bf91b
cell borders: change value ›single‹ to ›solid‹
dariok Apr 25, 2021
c62c80e
underline/line-through must not be ›single auto‹
dariok Apr 25, 2021
c820f95
preserve alignment, paragraph style name in cells
dariok Apr 26, 2021
611280a
bugfix when getting initial footnote number
dariok May 24, 2021
31c2cfd
imnprove eval of starting numbers for FN
dariok Jun 23, 2021
af935fd
Merge branch 'master' of github.com:dariok/w2tei
dariok Jun 23, 2021
ee46c5b
separate lists
dariok Jun 30, 2021
febd3e0
Merge branch 'master' of github.com:dariok/w2tei
dariok Jun 30, 2021
6252b53
add wavy underline
dariok Aug 14, 2021
ff0aaff
create tei:tagsDecl/tei:rendition for each used style
dariok Aug 15, 2021
b42b376
differentiate headings and lists
dariok Aug 15, 2021
a74edd3
first line indent
dariok Aug 16, 2021
f93911c
lists not starting at 1
dariok Sep 5, 2021
395a864
distinguish ordered and unordered lists
dariok Sep 5, 2021
9548d42
find headings by outline level
dariok Sep 6, 2021
22d6233
recognize headings by w:outlineLvl
dariok Sep 6, 2021
839a43c
styles: ignore iCs and bCs for now
dariok Sep 6, 2021
8f79840
remove attribute level
dariok Sep 6, 2021
8c0ea5a
XQL: add more files to extract filter
dariok Sep 6, 2021
fa2431c
when building XAR, include only necessary files
dariok Sep 6, 2021
10d3571
left indent of paragraph
dariok Sep 12, 2021
db4ac22
Merge branch 'master' of github.com:dariok/w2tei
dariok Sep 12, 2021
89705e1
improve construction of lists
dariok Sep 12, 2021
d9a016f
XSpec with query params
dariok Sep 12, 2021
279a097
retain empty paragraphs
dariok Sep 13, 2021
635525d
fixed typo evaluating w:ind/@w:left
dariok Sep 13, 2021
b39acb0
support dotted underline
dariok Oct 27, 2021
c0feefc
style values 'b:0' and 'i:0' must not create style attribute
dariok Jan 10, 2022
c732c4a
ExPath modules not available in Saxon HE
dariok Jan 26, 2022
c6535fc
Evaluate Relationship within environment
dariok Jan 27, 2022
2fecb5e
styles within a hyperlink must be retained
dariok Feb 10, 2022
5c30eb0
Links must work in list items, too
dariok Feb 14, 2022
c8c8f67
Extraction (extract-text) must work with XML decl
dariok Mar 6, 2022
0a3410e
Merge branch 'master' of https://github.com/dariok/w2tei
dariok Mar 6, 2022
d72d896
evaluate setting for styles of numbering levels
dariok Nov 11, 2023
d5a0ee9
improve outline numbering
dariok Dec 10, 2023
65e392e
create div structure if outline levels are missing
dariok Dec 10, 2023
5be34df
avoid error due to multiple w:r in field
dariok Sep 13, 2024
48d0aec
use internal heading encoding to figure out level
dariok Sep 13, 2025
a06c407
w:sdt → tei:ab
dariok Sep 13, 2025
3d6c43d
internal heading encoding does indeed indicate a… heading
dariok Sep 13, 2025
d24c789
add 2tei-post as submodule for uniform postprocessing
dariok Sep 13, 2025
254ff09
update transformation scenarios to use hi-processing from submodule
dariok Sep 13, 2025
930c0c2
include images as tei:figure/tei:graphic
dariok Nov 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/.project
/*.docx
/test/*.docx
add/wtotei-intro-result.html
add/*-report.html
*-report.html
*.zip
/fertig/
/test/
/result/
result/
xspec/
wt0.xml
wt1.xml
wt2.xml
ECMA-376, Fifth Edition, Part 1 - Fundamentals And Markup Language Reference/
build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "2tei-post"]
path = 2tei-post
url = ../2tei-post/
1 change: 1 addition & 0 deletions 2tei-post
Submodule 2tei-post added at e7758d
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Dario Kampkaspar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Word to TEI conversion - w2tei

A (currently) very basic web service to convert Word to TEI.
Some helper functions are included to make working with Word's XML less tiresome.
Also, some example transformations are available
A web service and collection of basic scripts to convert Word (XML or DOCX) to TEI.

**Incompatible change: As of 2020-11-23, paragraph style names (`w:pStyle/@w:val`) are recorded in `tei:p/@rendition`,
the definitions in `w:rPr` are kept in `tei:p/@style`.**

**Incompatible change: As of 2021-09-06, heading levels and div structure are evaluated based upon the values given by
w:outlineLvl in a paragraph preset or paragraph style; empty lines or a style called “Heading \d” will not suffice.
Paragraphs not having a defined outline level are not recognized as headings.**

## How to use (docx to Flat XML)

### Oxygen
1. Import the scenarios into “transformation scenarios“
1. applying “DOCX → Flat OPC” to a **docx** file will create a (very basic) flat XML file

### web service
Build the package using `ant` on `build.xml`. You can upload docx files via a web form or by POSTing them to cnvert2.xql

### CLI
! The older `zip:xml-entry` function is available in Saxon ⩽ 9.5.1.1 while `file:read-binary` and `archive:extract-text`
require Saxon *PE or EE* ⩾ 9.6. If you do not have Saxon PE or EE, you currently have to use a different XSLT processor,
use oXygen (as it includes a recent version ofSaxon PE and EE), or use the web service implementation from within
eXist-DB or baseX as these implement the ExPath modules independently.

To convert a docx, apply `docx.xsl` to `word-empty.xml` (or any XML file) and pass the parameter `filename` with a path
to the docx to be converted.

## How to use (XML to TEI)
apply basic transformation scenario to docx or apply wt0.xsl and wt1.xsl to any flat Word XML
76 changes: 67 additions & 9 deletions add/bibl.xsl
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="#all"
version="3.0">

<xsl:variable name="bibliography" select="doc('http://dev2.hab.de/edoc/data/ed000216/register/kgk_bibliography.xml')" />
<xsl:variable name="personenregister" select="doc('http://dev2.hab.de/edoc/data/ed000216/register/kgk_personenregister.xml')" />
<xsl:variable name="ortsregister" select="doc('http://dev2.hab.de/edoc/data/ed000216/register/kgk_ortsregister.xml')" />

<xsl:template match="tei:bibl">
<bibl>
<xsl:variable name="bibliography" select="doc('http://dev2.hab.de/edoc/ed000240/register/bibliography.xml')" />
<rs type="bibl">
<xsl:variable name="self" select="normalize-space()" />
<xsl:variable name="entry" select="$bibliography//tei:bibl[starts-with($self, normalize-space(tei:abbr))]"/>
<xsl:attribute name="ref">
<xsl:value-of select="'#'||$entry[1]/@xml:id"/>
</xsl:attribute>
<xsl:variable name="entry" select="$bibliography//tei:bibl[tei:abbr
and starts-with($self, normalize-space(tei:abbr))]"/>
<xsl:choose>
<xsl:when test="count($entry) > 0">
<xsl:attribute name="ref">
<xsl:value-of select="'#'||$entry[1]/@xml:id"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:comment>TODO ref eintragen!</xsl:comment>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="start">
<xsl:value-of select="substring-after(text()[1], normalize-space($entry[1]/tei:abbr))"/>
</xsl:variable>
Expand All @@ -25,7 +37,14 @@
<xsl:value-of select="normalize-space($start)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="node()[not(position() = 1 or position()=last())]" />
<xsl:choose>
<xsl:when test="string-length($start) = 0">
<xsl:sequence select="node()[not(position() = 1 or position()=last() or self::tei:hi[@rend = 'super'])]" />
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="node()[not(position() = 1 or position()=last())]" />
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="count(node()) = 1" />
<xsl:when test="node()[last()][self::text()]">
Expand All @@ -43,6 +62,45 @@
<xsl:sequence select="node()[last()]" />
</xsl:otherwise>
</xsl:choose>
</bibl>
</rs>
<xsl:if test="matches(., '\s$') and not(ancestor::tei:listBibl)">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>

<xsl:template match="tei:rs[@type = 'person']">
<rs type="person">
<xsl:variable name="self" select="string-join(analyze-string(normalize-space(), '''')//*:non-match, '')" />
<xsl:variable name="entry" select="$personenregister//tei:person[tei:persName[normalize-space() = $self]]"/>
<xsl:choose>
<xsl:when test="count($entry) > 0">
<xsl:attribute name="ref">
<xsl:value-of select="'#'||$entry[1]/@xml:id"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:comment>TODO ref eintragen!</xsl:comment>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="node()[not(self::comment())]" />
</rs>
</xsl:template>

<xsl:template match="tei:rs[@type = 'place']">
<rs type="place">
<xsl:variable name="self" select="string-join(analyze-string(normalize-space(), '''')//*:non-match, '')" />
<xsl:variable name="entry" select="$ortsregister//tei:place[descendant::tei:settlement[normalize-space() = $self]]"/>
<xsl:choose>
<xsl:when test="count($entry) > 0">
<xsl:attribute name="ref">
<xsl:value-of select="'#'||$entry[1]/@xml:id"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:comment>TODO ref eintragen!</xsl:comment>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="node()[not(self::comment())]" />
</rs>
</xsl:template>
</xsl:stylesheet>
Loading