Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / res / oriflamms-convert-transcriptions-orizones.xsl @ 2398

History | View | Annotate | Download (7.5 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="yes" />
12

    
13
	<xd:doc type="stylesheet">
14
		<xd:short>
15
			Cette feuille permet de convertir les données de zonage d'image produites
16
			par le logiciel Oriflamms (0.3.2) vers le format XML-TEI-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:variable name="filename">
37
		<xsl:analyze-string select="document-uri(.)"
38
			regex="^(.*)/([^/]+)\.[^/]+$">
39
			<xsl:matching-substring>
40
				<xsl:value-of select="regex-group(2)" />
41
			</xsl:matching-substring>
42
		</xsl:analyze-string>
43
	</xsl:variable>
44

    
45
	<xsl:variable name="filedir">
46
		<xsl:analyze-string select="document-uri(.)"
47
			regex="^(.*)/([^/]+)\.[^/]+$">
48
			<xsl:matching-substring>
49
				<xsl:value-of select="regex-group(1)" />
50
			</xsl:matching-substring>
51
		</xsl:analyze-string>
52
	</xsl:variable>
53

    
54
	<xsl:variable name="corpusid">
55
		<xsl:value-of select="replace($filename,'-w$','')" />
56
	</xsl:variable>
57

    
58
	<!-- <xsl:variable name="filenameresult"> <xsl:value-of select="replace($filename,'(-ori)?-w$','')"/> 
59
		</xsl:variable> -->
60

    
61
	<!--<xsl:param name="textFileName"><xsl:value-of select="$filename"/></xsl:param> -->
62

    
63
	<xsl:param name="imageZoneFileName">
64
		<xsl:value-of select="concat($filename,'-zones.xml')" />
65
	</xsl:param>
66

    
67
	<xsl:template match="*">
68
		<xsl:copy>
69
			<xsl:apply-templates select="@*" />
70
			<xsl:apply-templates
71
				select="*|processing-instruction()|comment()|text()" />
72
		</xsl:copy>
73
	</xsl:template>
74

    
75
	<xsl:template
76
		match="@*|comment()|processing-instruction()|text()">
77
		<xsl:copy />
78
	</xsl:template>
79

    
80
	<xsl:template match="/">
81
		<dummy>Les résultats sont enregistrés dans les dossiers zones et
82
			img-links</dummy>
83
		<xsl:apply-templates
84
			select="//tei:milestone[@unit='surface']" />
85
	</xsl:template>
86

    
87

    
88
	<xsl:template
89
		match="tei:milestone[@unit='surface' and not(ancestor::tei:supplied)]">
90

    
91
		<!--<xsl:variable name="fileid"> <xsl:value-of select="replace(@xml:id,'^surf_','')"/> 
92
			</xsl:variable> -->
93

    
94
		<xsl:result-document
95
			href="{$filedir}/../zones/{$corpusid}_{@xml:id}-zones.xml">
96
			<TEI xmlns="http://www.tei-c.org/ns/1.0">
97
				<teiHeader xmlns="http://www.tei-c.org/ns/1.0">
98
					<fileDesc xmlns="http://www.tei-c.org/ns/1.0">
99
						<titleStmt xmlns="http://www.tei-c.org/ns/1.0">
100
							<title xmlns="http://www.tei-c.org/ns/1.0">
101
								Zones d'image pour
102
								<xsl:value-of select="@xml:id" />
103
							</title>
104
							<respStmt xmlns="http://www.tei-c.org/ns/1.0">
105
								<resp xmlns="http://www.tei-c.org/ns/1.0">Création automatique du fichier</resp>
106
								<name xmlns="http://www.tei-c.org/ns/1.0" xml:id="TXM">Logiciel
107
									TXM (http://textometrie.ens-lyon.fr)</name>
108
							</respStmt>
109
						</titleStmt>
110
						<publicationStmt
111
							xmlns="http://www.tei-c.org/ns/1.0">
112
							<p xmlns="http://www.tei-c.org/ns/1.0">Projet Oriflamms (http://oriflamms.hypotheses.org)</p>
113
						</publicationStmt>
114
						<sourceDesc xmlns="http://www.tei-c.org/ns/1.0">
115
							<p>Généré à partir du fichier de transcription au format
116
								TEI-Oriflamms</p>
117
						</sourceDesc>
118
					</fileDesc>
119
					<revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
120
						<change
121
							when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#TXM"
122
							xmlns="http://www.tei-c.org/ns/1.0">Création du fichier</change>
123
					</revisionDesc>
124
				</teiHeader>
125
				<facsimile xml:base="../img/"
126
					xmlns="http://www.tei-c.org/ns/1.0">
127
					<surface xmlns="http://www.tei-c.org/ns/1.0"
128
						xml:id="{replace(@xml:id,'^surf_','surf_img')}">
129
						<!--<graphic url="{replace(following::tei:pb[1]/@facs,'\.tif$','.jpg')}"/> -->
130
						<graphic url="{following::tei:pb[1]/@facs}" />
131
					</surface>
132
				</facsimile>
133
			</TEI>
134
		</xsl:result-document>
135
		<xsl:result-document
136
			href="{$filedir}/../img_links/{$corpusid}_{@xml:id}-links.xml">
137
			<TEI xmlns="http://www.tei-c.org/ns/1.0">
138
				<teiHeader xmlns="http://www.tei-c.org/ns/1.0">
139
					<fileDesc xmlns="http://www.tei-c.org/ns/1.0">
140
						<titleStmt xmlns="http://www.tei-c.org/ns/1.0">
141
							<title xmlns="http://www.tei-c.org/ns/1.0">
142
								Données d'alignement pour les transcriptions et les zones
143
								d'image (
144
								<xsl:value-of select="$filename" />
145
								)
146
							</title>
147
							<respStmt xmlns="http://www.tei-c.org/ns/1.0">
148
								<resp xmlns="http://www.tei-c.org/ns/1.0">Création automatique du fichier</resp>
149
								<name xmlns="http://www.tei-c.org/ns/1.0" xml:id="TXM">Logiciel
150
									TXM (http://textometrie.ens-lyon.fr)</name>
151
							</respStmt>
152
						</titleStmt>
153
						<publicationStmt
154
							xmlns="http://www.tei-c.org/ns/1.0">
155
							<p xmlns="http://www.tei-c.org/ns/1.0">Projet Oriflamms (http://oriflamms.hypotheses.org)</p>
156
						</publicationStmt>
157
						<sourceDesc xmlns="http://www.tei-c.org/ns/1.0">
158
							<p>Généré à partir du fichier de transcription au format
159
								TEI-Oriflamms</p>
160
						</sourceDesc>
161
					</fileDesc>
162
					<encodingDesc xmlns="http://www.tei-c.org/ns/1.0">
163
						<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
164
							<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
165
								ident="txt" matchPattern="([a-z]+)"
166
								replacementPattern="../texts/{$corpusid}-c.xml#$1" />
167
							<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
168
								ident="img" matchPattern="([a-z]+)"
169
								replacementPattern="../zones/{$corpusid}_{@xml:id}-zones.xml#$1" />
170
						</listPrefixDef>
171
					</encodingDesc>
172
					<revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
173
						<change
174
							when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#TXM"
175
							xmlns="http://www.tei-c.org/ns/1.0">Création du fichier</change>
176
					</revisionDesc>
177
				</teiHeader>
178
				<text xmlns="http://www.tei-c.org/ns/1.0">
179
					<body xmlns="http://www.tei-c.org/ns/1.0">
180
						<ab type="linking" xmlns="http://www.tei-c.org/ns/1.0">
181
							<linkGrp type="surfaces"
182
								xmlns="http://www.tei-c.org/ns/1.0" />
183
							<linkGrp type="pages" xmlns="http://www.tei-c.org/ns/1.0" />
184
							<linkGrp type="columns"
185
								xmlns="http://www.tei-c.org/ns/1.0" />
186
							<linkGrp type="lines" xmlns="http://www.tei-c.org/ns/1.0" />
187
							<linkGrp type="words" xmlns="http://www.tei-c.org/ns/1.0" />
188
							<linkGrp type="characters"
189
								xmlns="http://www.tei-c.org/ns/1.0" />
190
						</ab>
191
					</body>
192
				</text>
193
			</TEI>
194
		</xsl:result-document>
195
	</xsl:template>
196

    
197

    
198
</xsl:stylesheet>