Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / bin / oriflamms-convert-transcriptions-orizones.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
  exclude-result-prefixes="tei edate xd txm" version="2.0">
7
  
8
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="yes"/>
9
  
10
  <xd:doc type="stylesheet">
11
    <xd:short>
12
      Cette feuille permet de convertir les données de zonage d'image produites 
13
      par le logiciel Oriflamms (0.3.2) vers le format XML-TEI-Oriflamms.
14
    </xd:short>
15
    <xd:detail>
16
      This stylesheet is free software; you can redistribute it and/or
17
      modify it under the terms of the GNU Lesser General Public
18
      License as published by the Free Software Foundation; either
19
      version 3 of the License, or (at your option) any later version.
20
      
21
      This stylesheet is distributed in the hope that it will be useful,
22
      but WITHOUT ANY WARRANTY; without even the implied warranty of
23
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24
      Lesser General Public License for more details.
25
      
26
      You should have received a copy of GNU Lesser Public License with
27
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
28
    </xd:detail>
29
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
30
    <xd:copyright>2015, CNRS / ICAR (Équipe CACTUS)</xd:copyright>
31
  </xd:doc>
32
  
33
  <xsl:variable name="filename">
34
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
35
      <xsl:matching-substring>
36
        <xsl:value-of select="regex-group(2)"/>
37
      </xsl:matching-substring>
38
    </xsl:analyze-string>
39
  </xsl:variable>
40
  
41
  <xsl:variable name="filedir">
42
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
43
      <xsl:matching-substring>
44
        <xsl:value-of select="regex-group(1)"/>
45
      </xsl:matching-substring>
46
    </xsl:analyze-string>
47
  </xsl:variable>
48

    
49
<xsl:variable name="corpusid">
50
  <xsl:value-of select="replace($filename,'-w$','')"/>
51
</xsl:variable>
52

    
53
  <!--  <xsl:variable name="filenameresult">
54
    <xsl:value-of select="replace($filename,'(-ori)?-w$','')"/>
55
  </xsl:variable>-->
56
  
57
  <!--<xsl:param name="textFileName"><xsl:value-of select="$filename"/></xsl:param>-->
58
  
59
  <xsl:param name="imageZoneFileName"><xsl:value-of select="concat($filename,'-zones.xml')"/></xsl:param>
60
  
61
  <xsl:template match="*">
62
    <xsl:copy>
63
      <xsl:apply-templates select="@*"/>
64
      <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
65
    </xsl:copy>
66
  </xsl:template>
67
  
68
  <xsl:template match="@*|comment()|processing-instruction()|text()">
69
    <xsl:copy/>
70
  </xsl:template>
71
  
72
<xsl:template match="/">
73
<dummy>Les résultats sont enregistrés dans les dossiers zones et img-links</dummy>
74
  <xsl:apply-templates select="//tei:milestone[@unit='surface']"/>
75
</xsl:template>
76

    
77

    
78
  <xsl:template match="tei:milestone[@unit='surface' and not(ancestor::tei:supplied)]">
79
    
80
    <!--<xsl:variable name="fileid">
81
      <xsl:value-of select="replace(@xml:id,'^surf_','')"/>
82
    </xsl:variable>-->
83
    
84
    <xsl:result-document href="{$filedir}/../zones/{$corpusid}_{@xml:id}-zones.xml">
85
      <TEI xmlns="http://www.tei-c.org/ns/1.0">
86
        <teiHeader xmlns="http://www.tei-c.org/ns/1.0">
87
          <fileDesc xmlns="http://www.tei-c.org/ns/1.0">
88
            <titleStmt xmlns="http://www.tei-c.org/ns/1.0">
89
              <title xmlns="http://www.tei-c.org/ns/1.0">Zones d'image pour <xsl:value-of select="@xml:id"/></title>
90
              <respStmt xmlns="http://www.tei-c.org/ns/1.0">
91
                <resp xmlns="http://www.tei-c.org/ns/1.0">Création automatique du fichier</resp>
92
                <name xmlns="http://www.tei-c.org/ns/1.0" xml:id="TXM">Logiciel TXM (http://textometrie.ens-lyon.fr)</name>
93
              </respStmt>
94
            </titleStmt>
95
            <publicationStmt xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0">Projet Oriflamms (http://oriflamms.hypotheses.org)</p></publicationStmt>
96
            <sourceDesc xmlns="http://www.tei-c.org/ns/1.0"><p>Généré à partir du fichier de transcription au format TEI-Oriflamms</p></sourceDesc>
97
          </fileDesc>
98
          <revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
99
            <change when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#TXM" xmlns="http://www.tei-c.org/ns/1.0">Création du fichier</change>
100
          </revisionDesc>
101
        </teiHeader>
102
        <facsimile xml:base="../img/" xmlns="http://www.tei-c.org/ns/1.0">
103
          <surface xmlns="http://www.tei-c.org/ns/1.0" xml:id="{replace(@xml:id,'^surf_','surf_img')}">
104
            <!--<graphic url="{replace(following::tei:pb[1]/@facs,'\.tif$','.jpg')}"/>-->
105
            <graphic url="{following::tei:pb[1]/@facs}"/>
106
          </surface>
107
        </facsimile>
108
      </TEI>
109
    </xsl:result-document>
110
    <xsl:result-document href="{$filedir}/../img_links/{$corpusid}_{@xml:id}-links.xml">
111
      <TEI xmlns="http://www.tei-c.org/ns/1.0">
112
        <teiHeader xmlns="http://www.tei-c.org/ns/1.0">
113
          <fileDesc xmlns="http://www.tei-c.org/ns/1.0">
114
            <titleStmt xmlns="http://www.tei-c.org/ns/1.0">
115
              <title xmlns="http://www.tei-c.org/ns/1.0">Données d'alignement pour les transcriptions et les zones d'image (<xsl:value-of select="$filename"/>)</title>
116
              <respStmt xmlns="http://www.tei-c.org/ns/1.0">
117
                <resp xmlns="http://www.tei-c.org/ns/1.0">Création automatique du fichier</resp>
118
                <name xmlns="http://www.tei-c.org/ns/1.0" xml:id="TXM">Logiciel TXM (http://textometrie.ens-lyon.fr)</name>
119
              </respStmt>
120
            </titleStmt>
121
            <publicationStmt xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0">Projet Oriflamms (http://oriflamms.hypotheses.org)</p></publicationStmt>
122
            <sourceDesc xmlns="http://www.tei-c.org/ns/1.0"><p>Généré à partir du fichier de transcription au format TEI-Oriflamms</p></sourceDesc>
123
          </fileDesc>
124
          <encodingDesc xmlns="http://www.tei-c.org/ns/1.0">
125
            <listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
126
              <prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="txt" matchPattern="([a-z]+)" replacementPattern="../texts/{$corpusid}-c.xml#$1"/>
127
              <prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="img" matchPattern="([a-z]+)" replacementPattern="../zones/{$corpusid}_{@xml:id}-zones.xml#$1"/>
128
            </listPrefixDef>
129
          </encodingDesc>
130
          <revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
131
            <change when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#TXM" xmlns="http://www.tei-c.org/ns/1.0">Création du fichier</change>
132
          </revisionDesc>
133
        </teiHeader>
134
        <text xmlns="http://www.tei-c.org/ns/1.0">
135
          <body xmlns="http://www.tei-c.org/ns/1.0">
136
            <ab type="linking" xmlns="http://www.tei-c.org/ns/1.0">
137
              <linkGrp type="surfaces" xmlns="http://www.tei-c.org/ns/1.0"/>
138
              <linkGrp type="pages" xmlns="http://www.tei-c.org/ns/1.0"/>
139
              <linkGrp type="columns" xmlns="http://www.tei-c.org/ns/1.0"/>
140
              <linkGrp type="lines" xmlns="http://www.tei-c.org/ns/1.0"/>
141
              <linkGrp type="words" xmlns="http://www.tei-c.org/ns/1.0"/>
142
              <linkGrp type="characters" xmlns="http://www.tei-c.org/ns/1.0"/>
143
            </ab>
144
          </body>
145
        </text>
146
      </TEI>
147
    </xsl:result-document>
148
  </xsl:template>
149
  
150
  
151
</xsl:stylesheet>