root / tmp / org.txm.oriflamms.rcp / res / oriflamms-convert-fontenay-oriflammsxml.xsl @ 476
History | View | Annotate | Download (8 kB)
1 |
<?xml version="1.0"?> |
---|---|
2 |
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times" |
3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
4 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
5 |
xmlns:txm="http://textometrie.org/1.0" |
6 |
xmlns:xi="http://www.w3.org/2001/XInclude" |
7 |
xmlns:svg="http://www.w3.org/2000/svg" |
8 |
xmlns:math="http://www.w3.org/1998/Math/MathML" |
9 |
exclude-result-prefixes="tei edate xd txm xi svg math" version="2.0"> |
10 |
|
11 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="yes"/> |
12 |
|
13 |
<xd:doc type="stylesheet"> |
14 |
<xd:short> |
15 |
Cette feuille permet de convertir les transcription des |
16 |
Chartes de Fontenay au format XML-TEI du projet Oriflamms. |
17 |
</xd:short> |
18 |
<xd:detail> |
19 |
This stylesheet is free software; you can redistribute it and/or |
20 |
modify it under the terms of the GNU Lesser General Public |
21 |
License as published by the Free Software Foundation; either |
22 |
version 3 of the License, or (at your option) any later version. |
23 |
|
24 |
This stylesheet is distributed in the hope that it will be useful, |
25 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
27 |
Lesser General Public License for more details. |
28 |
|
29 |
You should have received a copy of GNU Lesser Public License with |
30 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
31 |
</xd:detail> |
32 |
<xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author> |
33 |
<xd:copyright>2015, CNRS / ICAR (Équipe CACTUS)</xd:copyright> |
34 |
</xd:doc> |
35 |
|
36 |
<xsl:strip-space elements="*"/> |
37 |
|
38 |
<xsl:param name="baseMsSiglum">A</xsl:param> |
39 |
|
40 |
<xsl:variable name="baseMsPattern"><xsl:value-of select="concat('^#?',$baseMsSiglum,'| #?',$baseMsSiglum)"/></xsl:variable> |
41 |
|
42 |
<xsl:template match="node()"> |
43 |
<!-- Copy the current node --> |
44 |
<xsl:copy> |
45 |
<!-- Including any attributes it has and any child nodes --> |
46 |
<xsl:apply-templates select="@*|node()"/> |
47 |
</xsl:copy> |
48 |
</xsl:template> |
49 |
|
50 |
<!-- On supprime les attributs par défaut de la DTD TEI --> |
51 |
|
52 |
<xsl:template match="@*"> |
53 |
<xsl:choose> |
54 |
<xsl:when test="matches(name(.),'^(part|instant|anchored|full)$')"/> |
55 |
<xsl:otherwise><xsl:copy/></xsl:otherwise> |
56 |
</xsl:choose> |
57 |
</xsl:template> |
58 |
|
59 |
<xsl:template match="@facs"> |
60 |
<xsl:attribute name="facs"> |
61 |
<xsl:value-of select="replace(.,'\tif$','.png')"/> |
62 |
</xsl:attribute> |
63 |
</xsl:template> |
64 |
|
65 |
<xsl:template match="tei:teiHeader"> |
66 |
<xsl:copy> |
67 |
<xsl:apply-templates select="@*"/> |
68 |
<xsl:apply-templates/> |
69 |
</xsl:copy> |
70 |
</xsl:template> |
71 |
|
72 |
|
73 |
<xsl:template match="tei:revisionDesc"> |
74 |
<xsl:copy> |
75 |
<xsl:apply-templates select="@*"/> |
76 |
<change xmlns="http://www.tei-c.org/ns/1.0" when="2007-01-01" who="#DS">Publication du document original</change> |
77 |
<!-- information récupérée à partir de /TEI/text[1]/front[1]/titlePage[1]/docDate[1] --> |
78 |
<change xmlns="http://www.tei-c.org/ns/1.0" when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#auto">Conversion automatique au format XML-TEI-Oriflamms</change> |
79 |
<xsl:apply-templates/> |
80 |
</xsl:copy> |
81 |
</xsl:template> |
82 |
|
83 |
<xsl:template match="tei:encodingDesc"> |
84 |
<xsl:copy> |
85 |
<xsl:apply-templates select="@*"/> |
86 |
<xsl:apply-templates/> |
87 |
<xsl:if test="not(//tei:prefixDef[@ident='ori'])"> |
88 |
<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0"> |
89 |
<prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="ori" |
90 |
matchPattern="([a-z]+)" |
91 |
replacementPattern="oriflamms-annotation-scheme.xml#$1"> |
92 |
<p>In the context of this project, private URIs with the prefix |
93 |
"ori" point to <gi>interp</gi> elements in the project's |
94 |
oriflamms-annotation-scheme.xml file. |
95 |
</p> |
96 |
</prefixDef> |
97 |
</listPrefixDef> |
98 |
</xsl:if> |
99 |
</xsl:copy> |
100 |
</xsl:template> |
101 |
|
102 |
<!-- On restructure le document pour avoir un TEI par charte --> |
103 |
|
104 |
<!-- TEI devient teiCorpus --> |
105 |
|
106 |
<xsl:template match="tei:TEI"> |
107 |
<xsl:element name="teiCorpus" xmlns="http://www.tei-c.org/ns/1.0"> |
108 |
<xsl:apply-templates select="@*"/> |
109 |
<xsl:apply-templates/> |
110 |
</xsl:element> |
111 |
</xsl:template> |
112 |
|
113 |
<!-- on supprime l'élément text de niveau 1 et travaille directement sur le niveau 2 (l'élément group intermédiaire disparait)--> |
114 |
|
115 |
<xsl:template match="tei:TEI/tei:text"> |
116 |
<xsl:apply-templates select="descendant::tei:text"/> |
117 |
</xsl:template> |
118 |
|
119 |
<xsl:template match="tei:text//tei:text"> |
120 |
|
121 |
<TEI xmlns="http://www.tei-c.org/ns/1.0"> |
122 |
<teiHeader xmlns="http://www.tei-c.org/ns/1.0"> |
123 |
<fileDesc xmlns="http://www.tei-c.org/ns/1.0"> |
124 |
<titleStmt xmlns="http://www.tei-c.org/ns/1.0"> |
125 |
<title xmlns="http://www.tei-c.org/ns/1.0"><xsl:text>Acte original </xsl:text> |
126 |
<xsl:value-of select="substring-after(preceding-sibling::comment()[contains(.,'acte original')][1],'acte original ')"/></title> |
127 |
<author xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="descendant::tei:docAuthor"/></author> |
128 |
</titleStmt> |
129 |
<publicationStmt xmlns="http://www.tei-c.org/ns/1.0"> |
130 |
<p xmlns="http://www.tei-c.org/ns/1.0">See the header of the teiCorpus</p> |
131 |
</publicationStmt> |
132 |
<!-- les éléments listWit et listBibl sont placés dans sourceDesc --> |
133 |
<sourceDesc xmlns="http://www.tei-c.org/ns/1.0"> |
134 |
<xsl:copy-of select="descendant::tei:listWit"/> |
135 |
<xsl:copy-of select="descendant::tei:listBibl[1]"></xsl:copy-of> |
136 |
</sourceDesc> |
137 |
</fileDesc> |
138 |
<profileDesc xmlns="http://www.tei-c.org/ns/1.0"> |
139 |
<!-- docDate devient profileDesc/creation/date[@type='documentCreation'] --> |
140 |
<creation xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates select="descendant::tei:docDate"/></creation> |
141 |
<!-- argument devient profileDesc/abstract --> |
142 |
<xsl:apply-templates select="descendant::tei:argument"/> |
143 |
</profileDesc> |
144 |
</teiHeader> |
145 |
<text xmlns="http://www.tei-c.org/ns/1.0"> |
146 |
<body xmlns="http://www.tei-c.org/ns/1.0"> |
147 |
<xsl:apply-templates select="descendant::tei:div1"/> |
148 |
</body> |
149 |
</text> |
150 |
</TEI> |
151 |
</xsl:template> |
152 |
|
153 |
<xsl:template match="tei:docDate[ancestor::tei:group]"> |
154 |
<date type="documentCreation" xmlns="http://www.tei-c.org/ns/1.0"> |
155 |
<xsl:apply-templates select="@*"/> |
156 |
<xsl:apply-templates/> |
157 |
</date> |
158 |
</xsl:template> |
159 |
|
160 |
<xsl:template match="tei:argument"> |
161 |
<abstract xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></abstract> |
162 |
</xsl:template> |
163 |
|
164 |
|
165 |
<!-- patch of the wrong use of @break --> |
166 |
|
167 |
<xsl:template match="tei:lb[@break='yes']"> |
168 |
<xsl:copy> |
169 |
<xsl:apply-templates select="@*"/> |
170 |
<xsl:attribute name="break">no</xsl:attribute> |
171 |
</xsl:copy> |
172 |
</xsl:template> |
173 |
|
174 |
<!-- on ajoute un attribut pour faciliter l'identification des segments à ne pas aligner --> |
175 |
|
176 |
<xsl:template match="tei:choice/tei:expan|tei:choice/tei:corr"> |
177 |
<xsl:copy> |
178 |
<xsl:apply-templates select="@*"/> |
179 |
<xsl:attribute name="ana">ori:align-no</xsl:attribute> |
180 |
<xsl:apply-templates/> |
181 |
</xsl:copy> |
182 |
</xsl:template> |
183 |
|
184 |
<xsl:template match="tei:rdg[not(matches(@wit,$baseMsPattern))]"> |
185 |
<xsl:copy> |
186 |
<xsl:apply-templates select="@*"/> |
187 |
<xsl:attribute name="ana">ori:align-no</xsl:attribute> |
188 |
<xsl:apply-templates/> |
189 |
</xsl:copy> |
190 |
</xsl:template> |
191 |
|
192 |
<xsl:template match="text()[following-sibling::*[1][self::tei:milestone or self::tei:pb or self::tei:cb or self::tei:lb] and following-sibling::tei:lb[1][@break]]"> |
193 |
<xsl:choose> |
194 |
<!-- patch d'espace blanc devant les sauts de ligne à l'intérieur de mots --> |
195 |
<xsl:when test="matches(.,'\s+$')"><xsl:value-of select="replace(.,'\s+$','')"/></xsl:when> |
196 |
<xsl:otherwise><xsl:copy/></xsl:otherwise> |
197 |
</xsl:choose> |
198 |
</xsl:template> |
199 |
|
200 |
</xsl:stylesheet> |