Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / res / oriflamms-convert-charrettenew-oriflammsxml.xsl @ 2398

History | View | Annotate | Download (5.2 kB)

1
<?xml version="1.0"?>
2
<xsl:stylesheet
3
	xmlns:edate="http://exslt.org/dates-and-times"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
	xmlns:tei="http://www.tei-c.org/ns/1.0"
6
	xmlns:xd="http://www.pnp-software.com/XSLTdoc"
7
	xmlns:txm="http://textometrie.org/1.0"
8
	exclude-result-prefixes="tei edate xd txm" version="2.0">
9

    
10
	<xsl:output method="xml" encoding="utf-8"
11
		omit-xml-declaration="no" indent="no" />
12

    
13
	<xd:doc type="stylesheet">
14
		<xd:short>
15
			Cette feuille permet de convertir la transcription compacte de la
16
			Queste del saint Graal 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>2014, CNRS / ICAR (Équipe CACTUS)</xd:copyright>
34
	</xd:doc>
35

    
36
	<xsl:template match="/">
37
		<xsl:apply-templates />
38
	</xsl:template>
39

    
40

    
41
	<xsl:template match="*">
42
		<xsl:copy>
43
			<xsl:apply-templates select="@*" />
44
			<xsl:apply-templates
45
				select="*|processing-instruction()|comment()|text()" />
46
		</xsl:copy>
47
	</xsl:template>
48

    
49
	<xsl:template match="comment()|text()">
50
		<xsl:copy />
51
	</xsl:template>
52

    
53
	<xsl:template match="processing-instruction()"></xsl:template>
54

    
55
	<!-- On supprime les attributs par défaut de la DTD TEI -->
56

    
57
	<xsl:template match="@*">
58
		<xsl:choose>
59
			<xsl:when
60
				test="matches(name(.),'^(part|instant|anchored|full)$')" />
61
			<xsl:when test="matches(name(.),'rend')">
62
				<xsl:choose>
63
					<xsl:when test="matches(.,'^aggl$')">
64
						<xsl:attribute name="rend">space-after(none)</xsl:attribute>
65
					</xsl:when>
66
					<xsl:otherwise>
67
						<xsl:copy />
68
					</xsl:otherwise>
69
				</xsl:choose>
70
			</xsl:when>
71
			<xsl:otherwise>
72
				<xsl:copy />
73
			</xsl:otherwise>
74
		</xsl:choose>
75
	</xsl:template>
76

    
77
	<xsl:template match="tei:teiHeader">
78
		<xsl:copy>
79
			<xsl:apply-templates select="@*" />
80
			<xsl:apply-templates />
81
		</xsl:copy>
82
	</xsl:template>
83

    
84
	<xsl:template match="tei:revisionDesc">
85
		<xsl:copy>
86
			<xsl:apply-templates select="@*" />
87
			<change xmlns="http://www.tei-c.org/ns/1.0"
88
				when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#auto">Conversion
89
				automatique au format XML-TEI-Oriflamms</change>
90
			<xsl:apply-templates />
91
		</xsl:copy>
92
	</xsl:template>
93

    
94
	<xsl:template match="tei:encodingDesc">
95
		<xsl:copy>
96
			<xsl:apply-templates select="@*" />
97
			<xsl:apply-templates />
98
			<xsl:if test="not(//tei:prefixDef[@ident='ori'])">
99
				<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
100
					<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
101
						ident="ori" matchPattern="([a-z]+)"
102
						replacementPattern="oriflamms-annotation-scheme.xml#$1">
103
						<p>
104
							In the context of this project, private URIs with the prefix
105
							"ori" point to
106
							<gi>interp</gi>
107
							elements in the project's
108
							oriflamms-annotation-scheme.xml file.
109
						</p>
110
					</prefixDef>
111
				</listPrefixDef>
112
			</xsl:if>
113
		</xsl:copy>
114
	</xsl:template>
115

    
116

    
117
	<xsl:template match="tei:div3[@facs]">
118
		<xsl:variable name="facs">
119
			<xsl:value-of select="@facs" />
120
		</xsl:variable>
121
		<xsl:if test="not(preceding::tei:div3/@facs=$facs)">
122
			<milestone unit="surface"
123
				xmlns="http://www.tei-c.org/ns/1.0" facs="{@facs}" />
124
		</xsl:if>
125

    
126
		<pb xmlns="http://www.tei-c.org/ns/1.0" facs="{@facs}"
127
			n="{parent::div2/@n}{@n}" />
128
		<xsl:copy>
129
			<xsl:apply-templates select="@*|node()" />
130
		</xsl:copy>
131
	</xsl:template>
132

    
133
	<xsl:template match="tei:div3[not(@facs)]">
134
		<xsl:copy>
135
			<xsl:apply-templates select="@*" />
136
			<xsl:attribute name="ana"><xsl:text>ori:align-no</xsl:text></xsl:attribute>
137
			<xsl:apply-templates />
138
		</xsl:copy>
139
	</xsl:template>
140

    
141
	<xsl:template match="tei:div4">
142
		<cb xmlns="http://www.tei-c.org/ns/1.0" n="{@n}" />
143
		<xsl:copy>
144
			<xsl:apply-templates select="@*|node()" />
145
		</xsl:copy>
146
	</xsl:template>
147

    
148
	<xsl:template match="tei:l">
149
		<xsl:copy>
150
			<xsl:apply-templates select="@*" />
151
			<lb xmlns="http://www.tei-c.org/ns/1.0" n="{@n}" />
152
			<xsl:apply-templates />
153
		</xsl:copy>
154
	</xsl:template>
155

    
156
	<xsl:template match="tei:note|tei:supplied|tei:head">
157
		<xsl:copy>
158
			<xsl:apply-templates select="@*" />
159
			<xsl:attribute name="ana">
160
      <xsl:if test="@ana"><xsl:value-of
161
				select="concat(@ana,' ')" /></xsl:if>
162
      <xsl:text>ori:align-no</xsl:text>
163
    </xsl:attribute>
164
			<xsl:apply-templates />
165
		</xsl:copy>
166
	</xsl:template>
167

    
168
	<xsl:template match="tei:c[@type='lettrine']">
169
		<g xmlns="http://www.tei-c.org/ns/1.0" n="{@n}">
170
			<xsl:apply-templates select="@*|node()" />
171
		</g>
172
	</xsl:template>
173

    
174
</xsl:stylesheet>