Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / groovy / org / txm / macro / oriflamms / prepare / oriflamms-convert-charrettenew-oriflammsxml.xsl @ 1094

History | View | Annotate | Download (5.4 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="no"/>
9
  
10
  <xd:doc type="stylesheet">
11
    <xd:short>
12
      Cette feuille permet de convertir la transcription compacte de la 
13
      Queste del saint Graal au format XML-TEI du projet 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>2014, CNRS / ICAR (Équipe CACTUS)</xd:copyright>
31
  </xd:doc>
32
  
33
  <xsl:template match="/">
34
    <xsl:apply-templates/>
35
  </xsl:template>
36
  
37
  
38
  <xsl:template match="*">
39
        <xsl:copy>
40
          <xsl:apply-templates select="@*"/>
41
          <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
42
        </xsl:copy>
43
  </xsl:template>
44

    
45
  <xsl:template match="comment()|text()">
46
    <xsl:copy/>
47
  </xsl:template>
48
  
49
  <xsl:template match="processing-instruction()"></xsl:template>
50

    
51
  <!-- On supprime les attributs par défaut de la DTD TEI -->
52
  
53
  <xsl:template match="@*">
54
    <xsl:choose>
55
      <xsl:when test="matches(name(.),'^(part|instant|anchored|full)$')"/>
56
      <xsl:when test="matches(name(.),'rend')">
57
        <xsl:choose>
58
          <xsl:when test="matches(.,'^aggl$')"><xsl:attribute name="rend">space-after(none)</xsl:attribute></xsl:when>
59
          <xsl:otherwise><xsl:copy/></xsl:otherwise>
60
        </xsl:choose>
61
      </xsl:when>
62
      <xsl:otherwise><xsl:copy/></xsl:otherwise>
63
    </xsl:choose>
64
  </xsl:template>
65

    
66
  <xsl:template match="tei:teiHeader">    
67
      <xsl:copy>
68
        <xsl:apply-templates select="@*"/>
69
        <xsl:apply-templates/>
70
      </xsl:copy>    
71
  </xsl:template>
72

    
73
<xsl:template match="tei:revisionDesc">
74
  <xsl:copy>
75
  <xsl:apply-templates select="@*"/>
76
  <change xmlns="http://www.tei-c.org/ns/1.0" when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#auto">Conversion automatique au format XML-TEI-Oriflamms</change>
77
  <xsl:apply-templates/>
78
  </xsl:copy>
79
</xsl:template>
80
  
81
  <xsl:template match="tei:encodingDesc">
82
    <xsl:copy>
83
      <xsl:apply-templates select="@*"/>
84
      <xsl:apply-templates/>
85
      <xsl:if test="not(//tei:prefixDef[@ident='ori'])">
86
        <listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
87
          <prefixDef xmlns="http://www.tei-c.org/ns/1.0" ident="ori" 
88
            matchPattern="([a-z]+)" 
89
            replacementPattern="oriflamms-annotation-scheme.xml#$1">
90
            <p>In the context of this project, private URIs with the prefix
91
              "ori" point to <gi>interp</gi> elements in the project's
92
              oriflamms-annotation-scheme.xml file.
93
            </p>
94
          </prefixDef>
95
        </listPrefixDef>
96
      </xsl:if>
97
    </xsl:copy>
98
  </xsl:template>
99

    
100

    
101
<xsl:template match="tei:div3[@facs]">
102
  <xsl:variable name="facs">
103
    <xsl:value-of select="@facs"/>
104
  </xsl:variable>
105
  <xsl:if test="not(preceding::tei:div3/@facs=$facs)">
106
    <milestone unit="surface" xmlns="http://www.tei-c.org/ns/1.0" facs="{@facs}"/>
107
  </xsl:if>
108
    
109
  <pb xmlns="http://www.tei-c.org/ns/1.0" facs="{@facs}" n="{parent::div2/@n}{@n}"/>
110
  <xsl:copy>
111
    <xsl:apply-templates select="@*|node()"/>
112
  </xsl:copy>
113
</xsl:template>
114
  
115
  <xsl:template match="tei:div3[not(@facs)]">
116
    <xsl:copy>
117
      <xsl:apply-templates select="@*"/>
118
      <xsl:attribute name="ana"><xsl:text>ori:align-no</xsl:text></xsl:attribute>
119
      <xsl:apply-templates/>
120
    </xsl:copy>
121
  </xsl:template>
122
  
123
  <xsl:template match="tei:div4">
124
    <cb xmlns="http://www.tei-c.org/ns/1.0" n="{@n}"/>
125
    <xsl:copy>
126
      <xsl:apply-templates select="@*|node()"/>
127
    </xsl:copy>
128
  </xsl:template>
129

    
130
  <xsl:template match="tei:l">
131
    <xsl:copy>
132
      <xsl:apply-templates select="@*"/>
133
      <lb xmlns="http://www.tei-c.org/ns/1.0" n="{@n}"/>
134
      <xsl:apply-templates/>
135
    </xsl:copy>
136
  </xsl:template>  
137

    
138
<xsl:template match="tei:note|tei:supplied|tei:head">
139
  <xsl:copy>
140
    <xsl:apply-templates select="@*"/>
141
    <xsl:attribute name="ana">
142
      <xsl:if test="@ana"><xsl:value-of select="concat(@ana,' ')"/></xsl:if>
143
      <xsl:text>ori:align-no</xsl:text>
144
    </xsl:attribute>
145
    <xsl:apply-templates/>
146
  </xsl:copy>
147
</xsl:template>
148
  
149
<xsl:template match="tei:c[@type='lettrine']">
150
  <g xmlns="http://www.tei-c.org/ns/1.0" n="{@n}">
151
    <xsl:apply-templates select="@*|node()"/>
152
  </g>
153
</xsl:template>
154

    
155
</xsl:stylesheet>