Statistics
| Revision:

root / tmp / org.txm.core / bin / org / txm / macro / oriflamms / prepare / oriflamms-convert-transcriptions-orizones.xsl @ 54

History | View | Annotate | Download (6.9 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">Image zones for <xsl:value-of select="@xml:id"/></title>
90
            </titleStmt>
91
            <publicationStmt xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0">Oriflamms project</p></publicationStmt>
92
            <sourceDesc xmlns="http://www.tei-c.org/ns/1.0"><p>Converted from Oriflamms XML-TEI transcription file</p></sourceDesc>
93
          </fileDesc>
94
          <revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
95
            <change when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" xmlns="http://www.tei-c.org/ns/1.0">File created</change>
96
          </revisionDesc>
97
        </teiHeader>
98
        <facsimile xml:base="../img/" xmlns="http://www.tei-c.org/ns/1.0">
99
          <surface xmlns="http://www.tei-c.org/ns/1.0" xml:id="{replace(@xml:id,'^surf_','surf_img')}">
100
            <!--<graphic url="{replace(following::tei:pb[1]/@facs,'\.tif$','.jpg')}"/>-->
101
            <graphic url="{following::tei:pb[1]/@facs}"/>
102
          </surface>
103
        </facsimile>
104
      </TEI>
105
    </xsl:result-document>
106
    <xsl:result-document href="{$filedir}/../img_links/{$corpusid}_{@xml:id}-links.xml">
107
      <TEI xmlns="http://www.tei-c.org/ns/1.0">
108
        <teiHeader xmlns="http://www.tei-c.org/ns/1.0">
109
          <fileDesc xmlns="http://www.tei-c.org/ns/1.0">
110
            <titleStmt xmlns="http://www.tei-c.org/ns/1.0">
111
              <title xmlns="http://www.tei-c.org/ns/1.0">Linking data for document transcriptions and image zones (<xsl:value-of select="$filename"/>)</title>
112
            </titleStmt>
113
            <publicationStmt xmlns="http://www.tei-c.org/ns/1.0"><p xmlns="http://www.tei-c.org/ns/1.0">Oriflamms project ((http://oriflamms.hypotheses.org))</p></publicationStmt>
114
            <sourceDesc xmlns="http://www.tei-c.org/ns/1.0"><p>Converted from Oriflamms XML-TEI transcription file</p></sourceDesc>
115
          </fileDesc>
116
          <encodingDesc xmlns="http://www.tei-c.org/ns/1.0">
117
            <listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
118
              <prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="txt" matchPattern="([a-z]+)" replacementPattern="../texts/{$corpusid}-c.xml#$1"/>
119
              <prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="img" matchPattern="([a-z]+)" replacementPattern="../zones/{$corpusid}_{@xml:id}-zones.xml#$1"/>
120
            </listPrefixDef>
121
          </encodingDesc>
122
          <revisionDesc xmlns="http://www.tei-c.org/ns/1.0">
123
            <change when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" xmlns="http://www.tei-c.org/ns/1.0">File created</change>
124
          </revisionDesc>
125
        </teiHeader>
126
        <text xmlns="http://www.tei-c.org/ns/1.0">
127
          <body xmlns="http://www.tei-c.org/ns/1.0">
128
            <ab type="linking" xmlns="http://www.tei-c.org/ns/1.0">
129
              <linkGrp type="surfaces" xmlns="http://www.tei-c.org/ns/1.0"/>
130
              <linkGrp type="pages" xmlns="http://www.tei-c.org/ns/1.0"/>
131
              <linkGrp type="columns" xmlns="http://www.tei-c.org/ns/1.0"/>
132
              <linkGrp type="lines" xmlns="http://www.tei-c.org/ns/1.0"/>
133
              <linkGrp type="words" xmlns="http://www.tei-c.org/ns/1.0"/>
134
              <linkGrp type="characters" xmlns="http://www.tei-c.org/ns/1.0"/>
135
            </ab>
136
          </body>
137
        </text>
138
      </TEI>
139
    </xsl:result-document>
140
  </xsl:template>
141
  
142
  
143
</xsl:stylesheet>