Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / groovy / org / txm / macro / oriflamms / prepare / oriflamms-convert-transcriptions-orizones.xsl @ 2398

History | View | Annotate | Download (6.8 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
								Image zones for
102
								<xsl:value-of select="@xml:id" />
103
							</title>
104
						</titleStmt>
105
						<publicationStmt
106
							xmlns="http://www.tei-c.org/ns/1.0">
107
							<p xmlns="http://www.tei-c.org/ns/1.0">Oriflamms project</p>
108
						</publicationStmt>
109
						<sourceDesc xmlns="http://www.tei-c.org/ns/1.0">
110
							<p>Converted from Oriflamms XML-TEI transcription file</p>
111
						</sourceDesc>
112
					</fileDesc>
113
					<revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
114
						<change
115
							when="{format-date(current-date(),'[Y]-[M01]-[D01]')}"
116
							xmlns="http://www.tei-c.org/ns/1.0">File created</change>
117
					</revisionDesc>
118
				</teiHeader>
119
				<facsimile xml:base="../img/"
120
					xmlns="http://www.tei-c.org/ns/1.0">
121
					<surface xmlns="http://www.tei-c.org/ns/1.0"
122
						xml:id="{replace(@xml:id,'^surf_','surf_img')}">
123
						<!--<graphic url="{replace(following::tei:pb[1]/@facs,'\.tif$','.jpg')}"/> -->
124
						<graphic url="{following::tei:pb[1]/@facs}" />
125
					</surface>
126
				</facsimile>
127
			</TEI>
128
		</xsl:result-document>
129
		<xsl:result-document
130
			href="{$filedir}/../img_links/{$corpusid}_{@xml:id}-links.xml">
131
			<TEI xmlns="http://www.tei-c.org/ns/1.0">
132
				<teiHeader xmlns="http://www.tei-c.org/ns/1.0">
133
					<fileDesc xmlns="http://www.tei-c.org/ns/1.0">
134
						<titleStmt xmlns="http://www.tei-c.org/ns/1.0">
135
							<title xmlns="http://www.tei-c.org/ns/1.0">
136
								Linking data for document transcriptions and image zones (
137
								<xsl:value-of select="$filename" />
138
								)
139
							</title>
140
						</titleStmt>
141
						<publicationStmt
142
							xmlns="http://www.tei-c.org/ns/1.0">
143
							<p xmlns="http://www.tei-c.org/ns/1.0">Oriflamms project ((http://oriflamms.hypotheses.org))</p>
144
						</publicationStmt>
145
						<sourceDesc xmlns="http://www.tei-c.org/ns/1.0">
146
							<p>Converted from Oriflamms XML-TEI transcription file</p>
147
						</sourceDesc>
148
					</fileDesc>
149
					<encodingDesc xmlns="http://www.tei-c.org/ns/1.0">
150
						<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
151
							<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
152
								ident="txt" matchPattern="([a-z]+)"
153
								replacementPattern="../texts/{$corpusid}-c.xml#$1" />
154
							<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
155
								ident="img" matchPattern="([a-z]+)"
156
								replacementPattern="../zones/{$corpusid}_{@xml:id}-zones.xml#$1" />
157
						</listPrefixDef>
158
					</encodingDesc>
159
					<revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
160
						<change
161
							when="{format-date(current-date(),'[Y]-[M01]-[D01]')}"
162
							xmlns="http://www.tei-c.org/ns/1.0">File created</change>
163
					</revisionDesc>
164
				</teiHeader>
165
				<text xmlns="http://www.tei-c.org/ns/1.0">
166
					<body xmlns="http://www.tei-c.org/ns/1.0">
167
						<ab type="linking" xmlns="http://www.tei-c.org/ns/1.0">
168
							<linkGrp type="surfaces"
169
								xmlns="http://www.tei-c.org/ns/1.0" />
170
							<linkGrp type="pages" xmlns="http://www.tei-c.org/ns/1.0" />
171
							<linkGrp type="columns"
172
								xmlns="http://www.tei-c.org/ns/1.0" />
173
							<linkGrp type="lines" xmlns="http://www.tei-c.org/ns/1.0" />
174
							<linkGrp type="words" xmlns="http://www.tei-c.org/ns/1.0" />
175
							<linkGrp type="characters"
176
								xmlns="http://www.tei-c.org/ns/1.0" />
177
						</ab>
178
					</body>
179
				</text>
180
			</TEI>
181
		</xsl:result-document>
182
	</xsl:template>
183

    
184

    
185
</xsl:stylesheet>