root / tmp / org.txm.oriflamms.rcp / res / oriflamms-convert-psautiers-oriflammsxml.xsl @ 476
History | View | Annotate | Download (7.6 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="no"/> |
12 |
|
13 |
<xd:doc type="stylesheet"> |
14 |
<xd:short> |
15 |
Cette feuille permet de convertir les transcription des |
16 |
Psautiers 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="*|comment()"> |
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 |
<xsl:template match="processing-instruction()"/> |
51 |
|
52 |
<!-- On supprime les attributs par défaut de la DTD TEI --> |
53 |
|
54 |
<xsl:template match="@*"> |
55 |
<xsl:choose> |
56 |
<xsl:when test="matches(name(.),'^(part|instant|anchored|full)$')"/> |
57 |
<xsl:otherwise><xsl:copy/></xsl:otherwise> |
58 |
</xsl:choose> |
59 |
</xsl:template> |
60 |
|
61 |
<xsl:template match="@facs"> |
62 |
<xsl:attribute name="facs"> |
63 |
<xsl:choose> |
64 |
<xsl:when test="matches(.,'^http:')"> |
65 |
<xsl:value-of select="substring-after(.,'nomFichier=')"/> |
66 |
</xsl:when> |
67 |
<xsl:otherwise> |
68 |
<xsl:value-of select="."/> |
69 |
</xsl:otherwise> |
70 |
</xsl:choose> |
71 |
</xsl:attribute> |
72 |
</xsl:template> |
73 |
|
74 |
<xsl:template match="tei:teiHeader"> |
75 |
<xsl:copy> |
76 |
<xsl:apply-templates select="@*"/> |
77 |
<xsl:apply-templates/> |
78 |
</xsl:copy> |
79 |
</xsl:template> |
80 |
|
81 |
|
82 |
<xsl:template match="tei:revisionDesc"> |
83 |
<xsl:copy> |
84 |
<xsl:apply-templates select="@*"/> |
85 |
<change xmlns="http://www.tei-c.org/ns/1.0" when="2007-01-01" who="#DS">Publication du document original</change> |
86 |
<!-- information récupérée à partir de /TEI/text[1]/front[1]/titlePage[1]/docDate[1] --> |
87 |
<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> |
88 |
<xsl:apply-templates/> |
89 |
</xsl:copy> |
90 |
</xsl:template> |
91 |
|
92 |
<xsl:template match="tei:encodingDesc"> |
93 |
<xsl:copy> |
94 |
<xsl:apply-templates select="@*"/> |
95 |
<xsl:apply-templates/> |
96 |
<xsl:if test="not(//tei:prefixDef[@ident='ori'])"> |
97 |
<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0"> |
98 |
<prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="ori" |
99 |
matchPattern="([a-z]+)" |
100 |
replacementPattern="oriflamms-annotation-scheme.xml#$1"> |
101 |
<p>In the context of this project, private URIs with the prefix |
102 |
"ori" point to <gi>interp</gi> elements in the project's |
103 |
oriflamms-annotation-scheme.xml file. |
104 |
</p> |
105 |
</prefixDef> |
106 |
</listPrefixDef> |
107 |
</xsl:if> |
108 |
</xsl:copy> |
109 |
</xsl:template> |
110 |
|
111 |
<!-- On restructure le document pour avoir un TEI par charte --> |
112 |
|
113 |
<!-- TEI devient teiCorpus --> |
114 |
|
115 |
<xsl:template match="tei:TEI"> |
116 |
<xsl:element name="teiCorpus" xmlns="http://www.tei-c.org/ns/1.0"> |
117 |
<xsl:apply-templates select="@*"/> |
118 |
<xsl:apply-templates/> |
119 |
</xsl:element> |
120 |
</xsl:template> |
121 |
|
122 |
<!-- on supprime l'élément text de niveau 1 et travaille directement sur le niveau 2 (l'élément group intermédiaire disparait)--> |
123 |
|
124 |
<xsl:template match="tei:TEI/tei:text"> |
125 |
<xsl:apply-templates select="descendant::tei:text"/> |
126 |
</xsl:template> |
127 |
|
128 |
<xsl:template match="tei:text//tei:text"> |
129 |
|
130 |
<TEI xmlns="http://www.tei-c.org/ns/1.0"> |
131 |
<teiHeader xmlns="http://www.tei-c.org/ns/1.0"> |
132 |
<fileDesc xmlns="http://www.tei-c.org/ns/1.0"> |
133 |
<titleStmt xmlns="http://www.tei-c.org/ns/1.0"> |
134 |
<title xmlns="http://www.tei-c.org/ns/1.0"><xsl:text>Acte original </xsl:text> |
135 |
<xsl:value-of select="substring-after(preceding-sibling::comment()[contains(.,'acte original')][1],'acte original ')"/></title> |
136 |
<author xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="descendant::tei:docAuthor"/></author> |
137 |
</titleStmt> |
138 |
<publicationStmt xmlns="http://www.tei-c.org/ns/1.0"> |
139 |
<p xmlns="http://www.tei-c.org/ns/1.0">See the header of the teiCorpus</p> |
140 |
</publicationStmt> |
141 |
<!-- les éléments listWit et listBibl sont placés dans sourceDesc --> |
142 |
<sourceDesc xmlns="http://www.tei-c.org/ns/1.0"> |
143 |
<xsl:copy-of select="descendant::tei:listWit"/> |
144 |
<xsl:copy-of select="descendant::tei:listBibl[1]"></xsl:copy-of> |
145 |
</sourceDesc> |
146 |
</fileDesc> |
147 |
<profileDesc xmlns="http://www.tei-c.org/ns/1.0"> |
148 |
<!-- docDate devient profileDesc/creation/date[@type='documentCreation'] --> |
149 |
<creation xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates select="descendant::tei:docDate"/></creation> |
150 |
<!-- argument devient profileDesc/abstract --> |
151 |
<xsl:apply-templates select="descendant::tei:argument"/> |
152 |
</profileDesc> |
153 |
</teiHeader> |
154 |
<text xmlns="http://www.tei-c.org/ns/1.0"> |
155 |
<xsl:apply-templates/> |
156 |
</text> |
157 |
</TEI> |
158 |
</xsl:template> |
159 |
|
160 |
<!-- on supprime listWit du corps du texte (cf. l'entête) --> |
161 |
<xsl:template match="tei:listWit"/> |
162 |
|
163 |
<!-- on supprime les entêtes et pied de pages (non alignables) --> |
164 |
|
165 |
<xsl:template match="tei:fw"> |
166 |
<xsl:comment>fw : <xsl:copy-of select="."/></xsl:comment> |
167 |
</xsl:template> |
168 |
|
169 |
<!-- on ajoute un attribut pour faciliter l'identification des segments à ne pas aligner --> |
170 |
|
171 |
<xsl:template match="tei:choice/tei:expan|tei:choice/tei:corr|tei:supplied|tei:note"> |
172 |
<xsl:copy> |
173 |
<xsl:apply-templates select="@*"/> |
174 |
<xsl:attribute name="ana">ori:align-no</xsl:attribute> |
175 |
<xsl:apply-templates/> |
176 |
</xsl:copy> |
177 |
</xsl:template> |
178 |
|
179 |
|
180 |
<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='no']]"> |
181 |
<xsl:choose> |
182 |
<!-- patch d'espace blanc devant les sauts de ligne à l'intérieur de mots --> |
183 |
<xsl:when test="matches(.,'\s+$')"><xsl:value-of select="replace(.,'\s+$','')"/></xsl:when> |
184 |
<xsl:otherwise><xsl:copy/></xsl:otherwise> |
185 |
</xsl:choose> |
186 |
</xsl:template> |
187 |
|
188 |
</xsl:stylesheet> |