Revision 2398 tmp/org.txm.oriflamms.rcp/res/oriflamms-convert-graalc-oriflammsxml.xsl

oriflamms-convert-graalc-oriflammsxml.xsl (revision 2398)
1 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">
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">
7 9

  
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>
10
	<xsl:output method="xml" encoding="utf-8"
11
		omit-xml-declaration="no" indent="no" />
44 12

  
45
  <xsl:template match="comment()|text()">
46
    <xsl:copy/>
47
  </xsl:template>
48
  
49
  <xsl:template match="processing-instruction()"></xsl:template>
13
	<xd:doc type="stylesheet">
14
		<xd:short>
15
			Cette feuille permet de convertir la transcription compacte de la
16
			Queste del saint Graal au format XML-TEI du projet 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.
50 23

  
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>
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.
65 28

  
66
  <xsl:template match="tei:teiHeader">    
67
      <xsl:copy>
68
        <xsl:apply-templates select="@*"/>
69
        <xsl:apply-templates/>
70
      </xsl:copy>    
71
  </xsl:template>
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>2014, CNRS / ICAR (Équipe CACTUS)</xd:copyright>
34
	</xd:doc>
72 35

  
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>
36
	<xsl:template match="/">
37
		<xsl:apply-templates />
38
	</xsl:template>
99 39

  
100 40

  
101
<xsl:template match="tei:cb[@rend='hidden']">
102
  <xsl:comment>cb factice supprimé</xsl:comment>
103
</xsl:template>
41
	<xsl:template match="*">
42
		<xsl:copy>
43
			<xsl:apply-templates select="@*" />
44
			<xsl:apply-templates
45
				select="*|processing-instruction()|comment()|text()" />
46
		</xsl:copy>
47
	</xsl:template>
104 48

  
105
<xsl:template match="tei:note|tei:supplied[not(descendant::tei:lb)]">
106
  <xsl:copy>
107
    <xsl:apply-templates select="@*"/>
108
    <xsl:attribute name="ana">
109
      <xsl:if test="@ana"><xsl:value-of select="concat(@ana,' ')"/></xsl:if>
49
	<xsl:template match="comment()|text()">
50
		<xsl:copy />
51
	</xsl:template>
52

  
53
	<xsl:template match="processing-instruction()"></xsl:template>
54

  
55
	<!-- On supprime les attributs par défaut de la DTD TEI -->
56

  
57
	<xsl:template match="@*">
58
		<xsl:choose>
59
			<xsl:when
60
				test="matches(name(.),'^(part|instant|anchored|full)$')" />
61
			<xsl:when test="matches(name(.),'rend')">
62
				<xsl:choose>
63
					<xsl:when test="matches(.,'^aggl$')">
64
						<xsl:attribute name="rend">space-after(none)</xsl:attribute>
65
					</xsl:when>
66
					<xsl:otherwise>
67
						<xsl:copy />
68
					</xsl:otherwise>
69
				</xsl:choose>
70
			</xsl:when>
71
			<xsl:otherwise>
72
				<xsl:copy />
73
			</xsl:otherwise>
74
		</xsl:choose>
75
	</xsl:template>
76

  
77
	<xsl:template match="tei:teiHeader">
78
		<xsl:copy>
79
			<xsl:apply-templates select="@*" />
80
			<xsl:apply-templates />
81
		</xsl:copy>
82
	</xsl:template>
83

  
84
	<xsl:template match="tei:revisionDesc">
85
		<xsl:copy>
86
			<xsl:apply-templates select="@*" />
87
			<change xmlns="http://www.tei-c.org/ns/1.0"
88
				when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#auto">Conversion
89
				automatique au format XML-TEI-Oriflamms</change>
90
			<xsl:apply-templates />
91
		</xsl:copy>
92
	</xsl:template>
93

  
94
	<xsl:template match="tei:encodingDesc">
95
		<xsl:copy>
96
			<xsl:apply-templates select="@*" />
97
			<xsl:apply-templates />
98
			<xsl:if test="not(//tei:prefixDef[@ident='ori'])">
99
				<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
100
					<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
101
						ident="ori" matchPattern="([a-z]+)"
102
						replacementPattern="oriflamms-annotation-scheme.xml#$1">
103
						<p>
104
							In the context of this project, private URIs with the prefix
105
							"ori" point to
106
							<gi>interp</gi>
107
							elements in the project's
108
							oriflamms-annotation-scheme.xml file.
109
						</p>
110
					</prefixDef>
111
				</listPrefixDef>
112
			</xsl:if>
113
		</xsl:copy>
114
	</xsl:template>
115

  
116

  
117
	<xsl:template match="tei:cb[@rend='hidden']">
118
		<xsl:comment>
119
			cb factice supprimé
120
		</xsl:comment>
121
	</xsl:template>
122

  
123
	<xsl:template
124
		match="tei:note|tei:supplied[not(descendant::tei:lb)]">
125
		<xsl:copy>
126
			<xsl:apply-templates select="@*" />
127
			<xsl:attribute name="ana">
128
      <xsl:if test="@ana"><xsl:value-of
129
				select="concat(@ana,' ')" /></xsl:if>
110 130
      <xsl:text>ori:align-no</xsl:text>
111 131
    </xsl:attribute>
112
    <xsl:apply-templates/>
113
  </xsl:copy>
114
</xsl:template>
115
  
116
  <xsl:template match="tei:supplied[descendant::tei:lb]">
117
    <xsl:comment>Ajout éditorial supprimé.</xsl:comment>
118
  </xsl:template>
132
			<xsl:apply-templates />
133
		</xsl:copy>
134
	</xsl:template>
119 135

  
120
<!--<xsl:template match="tei:pb[not(preceding-sibling::*[1][self::tei:milestone[@unit='surface']] or ancestor::tei:supplied)]">
121
  <milestone xmlns="http://www.tei-c.org/ns/1.0" unit="surface" facs="{@facs}"/>
122
  <xsl:copy>
123
    <xsl:apply-templates select="@*"/>
124
  </xsl:copy>
125
</xsl:template>-->
136
	<xsl:template match="tei:supplied[descendant::tei:lb]">
137
		<xsl:comment>
138
			Ajout éditorial supprimé.
139
		</xsl:comment>
140
	</xsl:template>
126 141

  
127
<xsl:template match="tei:w[matches(@type,'^PON')]">
128
  <pc xmlns="http://www.tei-c.org/ns/1.0">
129
    <xsl:apply-templates select="@*"/>
130
    <xsl:analyze-string select="." regex="^(.*)%(.*)%(.*)$">
131
      <xsl:matching-substring>
132
        <xsl:choose>
133
          <xsl:when test="matches(regex-group(3),'^$')">
134
            <xsl:attribute name="ana">ori:align-no</xsl:attribute>
135
            <reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no"><xsl:value-of select="regex-group(1)"/></reg>
136
          </xsl:when>
137
          <xsl:when test="matches(regex-group(1),'^$')">
138
            <orig xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(3)"/></orig>
139
          </xsl:when>
140
          <xsl:otherwise>
141
            <choice xmlns="http://www.tei-c.org/ns/1.0">
142
              <reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no"><xsl:value-of select="regex-group(1)"/></reg>
143
              <orig xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(3)"/></orig>
144
            </choice>
145
          </xsl:otherwise>
146
        </xsl:choose>        
147
      </xsl:matching-substring>
148
      <xsl:non-matching-substring><xsl:value-of select="."/></xsl:non-matching-substring>
149
    </xsl:analyze-string>
150
  </pc>
151
</xsl:template>
142
	<!--<xsl:template match="tei:pb[not(preceding-sibling::*[1][self::tei:milestone[@unit='surface']] 
143
		or ancestor::tei:supplied)]"> <milestone xmlns="http://www.tei-c.org/ns/1.0" 
144
		unit="surface" facs="{@facs}"/> <xsl:copy> <xsl:apply-templates select="@*"/> 
145
		</xsl:copy> </xsl:template> -->
152 146

  
153
  <xsl:template match="tei:orig">
154
    <xsl:apply-templates/>
155
  </xsl:template>
147
	<xsl:template match="tei:w[matches(@type,'^PON')]">
148
		<pc xmlns="http://www.tei-c.org/ns/1.0">
149
			<xsl:apply-templates select="@*" />
150
			<xsl:analyze-string select="."
151
				regex="^(.*)%(.*)%(.*)$">
152
				<xsl:matching-substring>
153
					<xsl:choose>
154
						<xsl:when test="matches(regex-group(3),'^$')">
155
							<xsl:attribute name="ana">ori:align-no</xsl:attribute>
156
							<reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no">
157
								<xsl:value-of select="regex-group(1)" />
158
							</reg>
159
						</xsl:when>
160
						<xsl:when test="matches(regex-group(1),'^$')">
161
							<orig xmlns="http://www.tei-c.org/ns/1.0">
162
								<xsl:value-of select="regex-group(3)" />
163
							</orig>
164
						</xsl:when>
165
						<xsl:otherwise>
166
							<choice xmlns="http://www.tei-c.org/ns/1.0">
167
								<reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no">
168
									<xsl:value-of select="regex-group(1)" />
169
								</reg>
170
								<orig xmlns="http://www.tei-c.org/ns/1.0">
171
									<xsl:value-of select="regex-group(3)" />
172
								</orig>
173
							</choice>
174
						</xsl:otherwise>
175
					</xsl:choose>
176
				</xsl:matching-substring>
177
				<xsl:non-matching-substring>
178
					<xsl:value-of select="." />
179
				</xsl:non-matching-substring>
180
			</xsl:analyze-string>
181
		</pc>
182
	</xsl:template>
156 183

  
184
	<xsl:template match="tei:orig">
185
		<xsl:apply-templates />
186
	</xsl:template>
157 187

  
158 188

  
159
  <xsl:template match="tei:w[not(matches(@type,'^PON'))]//text()|tei:del[not(ancestor::tei:w or descendant::tei:w)]//text()">
160
    <xsl:choose>
161
      <xsl:when test="matches(.,'^\s*$')"><xsl:copy/></xsl:when>
162
      <xsl:otherwise>
163
        <xsl:analyze-string select="." regex="#?\*[ijuvIJUVí]|#[A-Za-zÀ-ÿſ]|\{{\{{[^}}]+\}}\}}|#?\(\([^)]+\)\).?|_">
164
          <xsl:matching-substring>
165
            <xsl:choose>
166
              <xsl:when test="matches(.,'\(\(')">
167
                <xsl:analyze-string select="." regex="^#?\(\(([^\)]+)\)\)(.?)$">
168
                  <xsl:matching-substring>
169
                    <xsl:variable name="capitalize">
170
                      <xsl:choose>
171
                        <xsl:when test="matches(.,'^#') or matches(.,'_#')">yes</xsl:when>
172
                        <xsl:otherwise>no</xsl:otherwise>
173
                      </xsl:choose>
174
                    </xsl:variable>
175
                    <xsl:variable name="nextLetter"><xsl:value-of select="regex-group(2)"/></xsl:variable>
176
                    <xsl:variable name="abbrexpan">
177
                      <xsl:value-of select="replace(regex-group(1),'#','')"/>
178
                      <!--<xsl:value-of select="regex-group(1)"/>-->
179
                    </xsl:variable>
180
                    
181
                    <xsl:variable name="abbr">
182
                      <xsl:choose>
183
                        <xsl:when test="matches($abbrexpan,'_')"><xsl:value-of select="substring-before($abbrexpan,'_')"/></xsl:when>
184
                        <xsl:when test="matches($abbrexpan,'^#?(.&#x0305;|.&#x0363;|.&#x0364;|.&#x0365;|bn&#x0305;|ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;|gn&#x0363;t|qn&#x0363;t|&#x035B;|&#x1DD1;|&#x204A;|&#x223B;|&#xA76F;|&#xA770;|&#xF153;|&#xF158;|&#xF1C8;)$')">
185
                          <xsl:value-of select="$abbrexpan"/>
186
                        </xsl:when>
187
                        <xsl:otherwise>xxx</xsl:otherwise>
188
                      </xsl:choose>
189
                    </xsl:variable>
190
                    <xsl:variable name="expannocap" as="element()">
191
                      <expan xmlns="http://www.tei-c.org/ns/1.0">
192
                        <xsl:choose>
193
                          <xsl:when test="matches($abbrexpan,'_')">
194
                            <xsl:analyze-string select="substring-after($abbrexpan,'_')" regex="\[([^\]]+)\]">
195
                              <xsl:matching-substring>
196
                                <ex xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(1)"/></ex>
197
                              </xsl:matching-substring>
198
                              <xsl:non-matching-substring>
199
                                <xsl:copy/>
200
                              </xsl:non-matching-substring>
201
                            </xsl:analyze-string>
202
                          </xsl:when>
203
                          <xsl:when test="matches($abbrexpan,'^bn&#x0305;$')">b<ex xmlns="http://www.tei-c.org/ns/1.0">ie</ex>n</xsl:when>
204
                          <xsl:when test="matches($abbrexpan,'^(ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;)$')">ch<ex xmlns="http://www.tei-c.org/ns/1.0">evalie</ex>r</xsl:when>
205
                          <xsl:when test="matches($abbrexpan,'gn&#x0363;t')">g<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex><c xmlns="http://www.tei-c.org/ns/1.0" rend="position(combsup)">a</c>nt</xsl:when>
206
                          <xsl:when test="matches($abbrexpan,'qn&#x0363;t')">q<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex><c xmlns="http://www.tei-c.org/ns/1.0" rend="position(combsup)">a</c>nt</xsl:when>
207
                          <xsl:when test="matches($abbrexpan,'.&#x0305;$')">
208
                            <xsl:value-of select="substring($abbrexpan,1,1)"/>
209
                            <xsl:choose>
210
                              <xsl:when test="matches($abbrexpan,'^[aeiou]') and matches($nextLetter,'[bmnp]')"><ex xmlns="http://www.tei-c.org/ns/1.0">m</ex></xsl:when>
211
                              <xsl:when test="matches($abbrexpan,'^[aeiou]')"><ex xmlns="http://www.tei-c.org/ns/1.0">n</ex></xsl:when>
212
                              <xsl:when test="matches($abbrexpan,'^[q]')"><ex xmlns="http://www.tei-c.org/ns/1.0">ue</ex></xsl:when>
213
                              <xsl:when test="matches($abbrexpan,'^[p]')"><ex xmlns="http://www.tei-c.org/ns/1.0">re</ex></xsl:when>
214
                              <xsl:otherwise>‹bar›</xsl:otherwise>
215
                            </xsl:choose>
216
                          </xsl:when>
217
                          <xsl:when test="matches($abbrexpan,'.&#x0363;')">
218
                            <xsl:value-of select="substring($abbrexpan,1,1)"/>
219
                            <xsl:choose>
220
                              <xsl:when test="matches($abbrexpan,'^[Qq]')"><ex xmlns="http://www.tei-c.org/ns/1.0">u</ex></xsl:when>
221
                              <xsl:otherwise><ex xmlns="http://www.tei-c.org/ns/1.0">r</ex></xsl:otherwise>
222
                            </xsl:choose>
223
                            <c xmlns="http://www.tei-c.org/ns/1.0" rend="position(combsup)">a</c>
224
                          </xsl:when>
225
                          <xsl:when test="matches($abbrexpan,'.&#x0364;')">
226
                            <xsl:value-of select="substring($abbrexpan,1,1)"/>
227
                            <xsl:choose>
228
                              <xsl:when test="matches($abbrexpan,'^[Qq]')"><ex xmlns="http://www.tei-c.org/ns/1.0">u</ex></xsl:when>
229
                              <xsl:otherwise><ex xmlns="http://www.tei-c.org/ns/1.0">r</ex></xsl:otherwise>
230
                            </xsl:choose>
231
                            <c xmlns="http://www.tei-c.org/ns/1.0" rend="position(combsup)">e</c>
232
                          </xsl:when>
233
                          <xsl:when test="matches($abbrexpan,'.&#x0365;')">
234
                            <xsl:value-of select="substring($abbrexpan,1,1)"/>
235
                            <xsl:choose>
236
                              <xsl:when test="matches($abbrexpan,'^[Qq]')"><ex xmlns="http://www.tei-c.org/ns/1.0">u</ex></xsl:when>
237
                              <xsl:otherwise><ex xmlns="http://www.tei-c.org/ns/1.0">r</ex></xsl:otherwise>
238
                            </xsl:choose>
239
                            <c xmlns="http://www.tei-c.org/ns/1.0" rend="position(combsup)">i</c>
240
                          </xsl:when>
241
                          <xsl:when test="matches($abbrexpan,'&#xA76F;') and matches($nextLetter,'[bmnp]')">
242
                            <ex xmlns="http://www.tei-c.org/ns/1.0">com</ex>
243
                          </xsl:when>
244
                          <xsl:when test="matches($abbrexpan,'&#xA76F;')">
245
                            <ex xmlns="http://www.tei-c.org/ns/1.0">con</ex>
246
                          </xsl:when>
247
                          <xsl:when test="matches($abbrexpan,'&#x035B;|&#xF1C8;')">
248
                            <ex xmlns="http://www.tei-c.org/ns/1.0">er</ex>
249
                          </xsl:when>
250
                          <xsl:when test="matches($abbrexpan,'&#x204A;|&#xF158;')">
251
                            <ex xmlns="http://www.tei-c.org/ns/1.0">et</ex>
252
                          </xsl:when>
253
                          <xsl:when test="matches($abbrexpan,'&#x1DD1;|&#xF153;')">
254
                            <ex xmlns="http://www.tei-c.org/ns/1.0">ur</ex>
255
                          </xsl:when>
256
                          <xsl:when test="matches($abbrexpan,'&#xA770;')">
257
                            <ex xmlns="http://www.tei-c.org/ns/1.0">us</ex>
258
                          </xsl:when>
259
                          <xsl:otherwise>
260
                            <ex xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="$abbrexpan"/></ex><!--<xsl:comment>Unknown expan!</xsl:comment>-->
261
                          </xsl:otherwise>
262
                        </xsl:choose></expan>
263
                    </xsl:variable>
264
                    <xsl:variable name="expan">
265
                      <xsl:choose>
266
                        <xsl:when test="$capitalize eq 'yes'">
267
                          <expan xmlns="http://www.tei-c.org/ns/1.0">
268
                            <xsl:for-each select="$expannocap/node()">
269
                              <xsl:choose>
270
                                <xsl:when test="self::text()[not(preceding-sibling::*)]">
271
                                  <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small"><xsl:value-of select="upper-case(substring(.,1,1))"/></g><xsl:value-of select="substring(.,2)"/>
272
                                </xsl:when>
273
                                <xsl:when test="self::*[not(preceding-sibling::text())]">
274
                                  <xsl:copy><g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small"><xsl:value-of select="upper-case(substring(.,1,1))"/></g><xsl:value-of select="substring(.,2)"/></xsl:copy>
275
                                </xsl:when>
276
                                <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
277
                              </xsl:choose>
278
                            </xsl:for-each>
279
                          </expan>
280
                        </xsl:when>
281
                        <xsl:otherwise><xsl:copy-of select="$expannocap"/></xsl:otherwise>
282
                      </xsl:choose>
283
                    </xsl:variable>
284
                    <xsl:choose>
285
                      <xsl:when test="matches($abbr,'.+')">
286
                        <choice xmlns="http://www.tei-c.org/ns/1.0">
287
                          <abbr xmlns="http://www.tei-c.org/ns/1.0"><xsl:copy-of select="$abbr"/></abbr>
288
                          <xsl:copy-of select="$expan"/>
289
                        </choice>
290
                      </xsl:when>
291
                      <xsl:otherwise><xsl:copy-of select="$expan"/><!--<xsl:comment>Unknown abbr!</xsl:comment>--></xsl:otherwise>
292
                    </xsl:choose>
293
                    <xsl:value-of select="$nextLetter"/>
294
                  </xsl:matching-substring>
295
                  <xsl:non-matching-substring><xsl:copy-of select="."/><!--<xsl:comment>Unknown abbr-expan!</xsl:comment>--></xsl:non-matching-substring>
296
                </xsl:analyze-string>
297
              </xsl:when>
298
              <xsl:when test="matches(.,'#\*([ij])')">
299
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j"><xsl:value-of select="upper-case(regex-group(1))"/></g>
300
              </xsl:when>
301
              <xsl:when test="matches(.,'#\*([uv])')">
302
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v"><xsl:value-of select="upper-case(regex-group(1))"/></g>
303
              </xsl:when>
304
              <xsl:when test="matches(.,'\*í')">
305
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-i ori:facs-iacute">j</g>
306
              </xsl:when>
307
              <xsl:when test="matches(.,'\*([ij])')">
308
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j"><xsl:value-of select="regex-group(1)"/></g>
309
              </xsl:when>
310
              <xsl:when test="matches(.,'\*([uv])')">
311
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v"><xsl:value-of select="regex-group(1)"/></g>
312
              </xsl:when>
313
              <xsl:when test="matches(.,'#\*([IJ])')">
314
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I"><xsl:value-of select="lower-case(regex-group(1))"/></g>
315
              </xsl:when>
316
              <xsl:when test="matches(.,'#\*([UV])')">
317
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V"><xsl:value-of select="lower-case(regex-group(1))"/></g>
318
              </xsl:when>
319
              <xsl:when test="matches(.,'\*([IJ])')">
320
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I"><xsl:value-of select="regex-group(1)"/></g>
321
              </xsl:when>
322
              <xsl:when test="matches(.,'\*([UV])')">
323
                <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V"><xsl:value-of select="regex-group(1)"/></g>
324
              </xsl:when>
325
              <xsl:when test="matches(.,'#ſ')">
326
                <xsl:analyze-string select="." regex="^#(.)">
327
                  <xsl:matching-substring>
328
                    <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-caps ori:facs-slong">S</g>
329
                  </xsl:matching-substring>
330
                </xsl:analyze-string>
331
              </xsl:when>
332
              <!--  -->
333
<!--              <xsl:when test="matches(.,'#')">
334
                <xsl:analyze-string select="." regex="^#(.)">
335
                  <xsl:matching-substring>
336
                    <choice xmlns="http://www.tei-c.org/ns/1.0">
337
                      <abbr xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(1)"/></abbr>
338
                      <expan xmlns="http://www.tei-c.org/ns/1.0"><ex xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small">E</g>t</ex></expan>
339
                    </choice>
340
                  </xsl:matching-substring>
341
                </xsl:analyze-string>
342
              </xsl:when>              -->
343
              <xsl:when test="matches(.,'#[A-Z]')">
344
                <xsl:analyze-string select="." regex="^#(.)">
345
                  <xsl:matching-substring>
346
                    <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-caps"><xsl:value-of select="lower-case(regex-group(1))"/></g>
347
                  </xsl:matching-substring>
348
                </xsl:analyze-string>
349
              </xsl:when>
350
              <xsl:when test="matches(.,'#[^(]')">
351
                <xsl:analyze-string select="." regex="^#(.+)$">
352
                  <xsl:matching-substring>
353
                    <g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small"><xsl:value-of select="upper-case(regex-group(1))"/></g>
354
                  </xsl:matching-substring>
355
                </xsl:analyze-string>
356
              </xsl:when>
357
              <xsl:when test="matches(.,'\{\{([^}}]+)\}\}')">
358
                <xsl:analyze-string select="." regex="^\{{\{{([^:]*):([^:]*):([^:]*):([^:]*):?([^:]*)\}}\}}$">
359
                  <xsl:matching-substring>
360
                    <xsl:variable name="lettrine"><xsl:value-of select="regex-group(1)"/></xsl:variable>
361
                    <xsl:variable name="size"><xsl:value-of select="regex-group(2)"/></xsl:variable>
362
                    <xsl:variable name="sizeAct"><xsl:value-of select="regex-group(3)"/></xsl:variable>
363
                    <xsl:variable name="color"><xsl:value-of select="regex-group(4)"/></xsl:variable>
364
                    <xsl:variable name="deco"><xsl:value-of select="regex-group(5)"/></xsl:variable>
365
                    <xsl:variable name="rend">
366
                      <xsl:value-of select="concat('size(',$size,')')"/>
367
                      <xsl:if test="matches($sizeAct,'.+')"><xsl:value-of select="concat(' sizeAct(',$sizeAct,')')"/></xsl:if>
368
                      <xsl:if test="matches($color,'.+')"><xsl:value-of select="concat(' color(',$color,')')"/></xsl:if>
369
                      <xsl:if test="matches($deco,'.+')"><xsl:value-of select="concat(' deco(',$deco,')')"/></xsl:if>
370
                    </xsl:variable>
371
                    <g xmlns="http://www.tei-c.org/ns/1.0" type="lettrine" rend="{$rend}"><xsl:value-of select="$lettrine"/></g>
372
                  </xsl:matching-substring>
373
                </xsl:analyze-string>
374
              </xsl:when>
375
              
376
              <xsl:when test="matches(.,'__')">
377
                <space xmlns="http://www.tei-c.org/ns/1.0" ana="ori:figement"/>
378
              </xsl:when>
379
              <xsl:when test="matches(.,'_')">
380
                <space xmlns="http://www.tei-c.org/ns/1.0"/>
381
              </xsl:when>              
382
              <xsl:otherwise>Match: <xsl:copy/></xsl:otherwise>
383
            </xsl:choose>
384
          </xsl:matching-substring>
385
          <xsl:non-matching-substring>
386
            <xsl:copy/>
387
          </xsl:non-matching-substring>
388
        </xsl:analyze-string>
389
      </xsl:otherwise>
390
    </xsl:choose>
391
  </xsl:template>
392
  
393 189

  
190
	<xsl:template
191
		match="tei:w[not(matches(@type,'^PON'))]//text()|tei:del[not(ancestor::tei:w or descendant::tei:w)]//text()">
192
		<xsl:choose>
193
			<xsl:when test="matches(.,'^\s*$')">
194
				<xsl:copy />
195
			</xsl:when>
196
			<xsl:otherwise>
197
				<xsl:analyze-string select="."
198
					regex="#?\*[ijuvIJUVí]|#[A-Za-zÀ-ÿſ]|\{{\{{[^}}]+\}}\}}|#?\(\([^)]+\)\).?|_">
199
					<xsl:matching-substring>
200
						<xsl:choose>
201
							<xsl:when test="matches(.,'\(\(')">
202
								<xsl:analyze-string select="."
203
									regex="^#?\(\(([^\)]+)\)\)(.?)$">
204
									<xsl:matching-substring>
205
										<xsl:variable name="capitalize">
206
											<xsl:choose>
207
												<xsl:when test="matches(.,'^#') or matches(.,'_#')">
208
													yes
209
												</xsl:when>
210
												<xsl:otherwise>
211
													no
212
												</xsl:otherwise>
213
											</xsl:choose>
214
										</xsl:variable>
215
										<xsl:variable name="nextLetter">
216
											<xsl:value-of select="regex-group(2)" />
217
										</xsl:variable>
218
										<xsl:variable name="abbrexpan">
219
											<xsl:value-of
220
												select="replace(regex-group(1),'#','')" />
221
											<!--<xsl:value-of select="regex-group(1)"/> -->
222
										</xsl:variable>
394 223

  
224
										<xsl:variable name="abbr">
225
											<xsl:choose>
226
												<xsl:when test="matches($abbrexpan,'_')">
227
													<xsl:value-of
228
														select="substring-before($abbrexpan,'_')" />
229
												</xsl:when>
230
												<xsl:when
231
													test="matches($abbrexpan,'^#?(.&#x0305;|.&#x0363;|.&#x0364;|.&#x0365;|bn&#x0305;|ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;|gn&#x0363;t|qn&#x0363;t|&#x035B;|&#x1DD1;|&#x204A;|&#x223B;|&#xA76F;|&#xA770;|&#xF153;|&#xF158;|&#xF1C8;)$')">
232
													<xsl:value-of select="$abbrexpan" />
233
												</xsl:when>
234
												<xsl:otherwise>
235
													xxx
236
												</xsl:otherwise>
237
											</xsl:choose>
238
										</xsl:variable>
239
										<xsl:variable name="expannocap" as="element()">
240
											<expan xmlns="http://www.tei-c.org/ns/1.0">
241
												<xsl:choose>
242
													<xsl:when test="matches($abbrexpan,'_')">
243
														<xsl:analyze-string
244
															select="substring-after($abbrexpan,'_')"
245
															regex="\[([^\]]+)\]">
246
															<xsl:matching-substring>
247
																<ex xmlns="http://www.tei-c.org/ns/1.0">
248
																	<xsl:value-of select="regex-group(1)" />
249
																</ex>
250
															</xsl:matching-substring>
251
															<xsl:non-matching-substring>
252
																<xsl:copy />
253
															</xsl:non-matching-substring>
254
														</xsl:analyze-string>
255
													</xsl:when>
256
													<xsl:when
257
														test="matches($abbrexpan,'^bn&#x0305;$')">
258
														b
259
														<ex xmlns="http://www.tei-c.org/ns/1.0">ie</ex>
260
														n
261
													</xsl:when>
262
													<xsl:when
263
														test="matches($abbrexpan,'^(ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;)$')">
264
														ch
265
														<ex xmlns="http://www.tei-c.org/ns/1.0">evalie</ex>
266
														r
267
													</xsl:when>
268
													<xsl:when test="matches($abbrexpan,'gn&#x0363;t')">
269
														g
270
														<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
271
														<c xmlns="http://www.tei-c.org/ns/1.0"
272
															rend="position(combsup)">a</c>
273
														nt
274
													</xsl:when>
275
													<xsl:when test="matches($abbrexpan,'qn&#x0363;t')">
276
														q
277
														<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
278
														<c xmlns="http://www.tei-c.org/ns/1.0"
279
															rend="position(combsup)">a</c>
280
														nt
281
													</xsl:when>
282
													<xsl:when test="matches($abbrexpan,'.&#x0305;$')">
283
														<xsl:value-of
284
															select="substring($abbrexpan,1,1)" />
285
														<xsl:choose>
286
															<xsl:when
287
																test="matches($abbrexpan,'^[aeiou]') and matches($nextLetter,'[bmnp]')">
288
																<ex xmlns="http://www.tei-c.org/ns/1.0">m</ex>
289
															</xsl:when>
290
															<xsl:when test="matches($abbrexpan,'^[aeiou]')">
291
																<ex xmlns="http://www.tei-c.org/ns/1.0">n</ex>
292
															</xsl:when>
293
															<xsl:when test="matches($abbrexpan,'^[q]')">
294
																<ex xmlns="http://www.tei-c.org/ns/1.0">ue</ex>
295
															</xsl:when>
296
															<xsl:when test="matches($abbrexpan,'^[p]')">
297
																<ex xmlns="http://www.tei-c.org/ns/1.0">re</ex>
298
															</xsl:when>
299
															<xsl:otherwise>
300
																‹bar›
301
															</xsl:otherwise>
302
														</xsl:choose>
303
													</xsl:when>
304
													<xsl:when test="matches($abbrexpan,'.&#x0363;')">
305
														<xsl:value-of
306
															select="substring($abbrexpan,1,1)" />
307
														<xsl:choose>
308
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
309
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
310
															</xsl:when>
311
															<xsl:otherwise>
312
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
313
															</xsl:otherwise>
314
														</xsl:choose>
315
														<c xmlns="http://www.tei-c.org/ns/1.0"
316
															rend="position(combsup)">a</c>
317
													</xsl:when>
318
													<xsl:when test="matches($abbrexpan,'.&#x0364;')">
319
														<xsl:value-of
320
															select="substring($abbrexpan,1,1)" />
321
														<xsl:choose>
322
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
323
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
324
															</xsl:when>
325
															<xsl:otherwise>
326
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
327
															</xsl:otherwise>
328
														</xsl:choose>
329
														<c xmlns="http://www.tei-c.org/ns/1.0"
330
															rend="position(combsup)">e</c>
331
													</xsl:when>
332
													<xsl:when test="matches($abbrexpan,'.&#x0365;')">
333
														<xsl:value-of
334
															select="substring($abbrexpan,1,1)" />
335
														<xsl:choose>
336
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
337
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
338
															</xsl:when>
339
															<xsl:otherwise>
340
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
341
															</xsl:otherwise>
342
														</xsl:choose>
343
														<c xmlns="http://www.tei-c.org/ns/1.0"
344
															rend="position(combsup)">i</c>
345
													</xsl:when>
346
													<xsl:when
347
														test="matches($abbrexpan,'&#xA76F;') and matches($nextLetter,'[bmnp]')">
348
														<ex xmlns="http://www.tei-c.org/ns/1.0">com</ex>
349
													</xsl:when>
350
													<xsl:when test="matches($abbrexpan,'&#xA76F;')">
351
														<ex xmlns="http://www.tei-c.org/ns/1.0">con</ex>
352
													</xsl:when>
353
													<xsl:when
354
														test="matches($abbrexpan,'&#x035B;|&#xF1C8;')">
355
														<ex xmlns="http://www.tei-c.org/ns/1.0">er</ex>
356
													</xsl:when>
357
													<xsl:when
358
														test="matches($abbrexpan,'&#x204A;|&#xF158;')">
359
														<ex xmlns="http://www.tei-c.org/ns/1.0">et</ex>
360
													</xsl:when>
361
													<xsl:when
362
														test="matches($abbrexpan,'&#x1DD1;|&#xF153;')">
363
														<ex xmlns="http://www.tei-c.org/ns/1.0">ur</ex>
364
													</xsl:when>
365
													<xsl:when test="matches($abbrexpan,'&#xA770;')">
366
														<ex xmlns="http://www.tei-c.org/ns/1.0">us</ex>
367
													</xsl:when>
368
													<xsl:otherwise>
369
														<ex xmlns="http://www.tei-c.org/ns/1.0">
370
															<xsl:value-of select="$abbrexpan" />
371
														</ex><!--<xsl:comment>Unknown expan!</xsl:comment> -->
372
													</xsl:otherwise>
373
												</xsl:choose>
374
											</expan>
375
										</xsl:variable>
376
										<xsl:variable name="expan">
377
											<xsl:choose>
378
												<xsl:when test="$capitalize eq 'yes'">
379
													<expan xmlns="http://www.tei-c.org/ns/1.0">
380
														<xsl:for-each select="$expannocap/node()">
381
															<xsl:choose>
382
																<xsl:when
383
																	test="self::text()[not(preceding-sibling::*)]">
384
																	<g xmlns="http://www.tei-c.org/ns/1.0"
385
																		ana="ori:dipl-small">
386
																		<xsl:value-of
387
																			select="upper-case(substring(.,1,1))" />
388
																	</g>
389
																	<xsl:value-of select="substring(.,2)" />
390
																</xsl:when>
391
																<xsl:when
392
																	test="self::*[not(preceding-sibling::text())]">
393
																	<xsl:copy>
394
																		<g xmlns="http://www.tei-c.org/ns/1.0"
395
																			ana="ori:dipl-small">
396
																			<xsl:value-of
397
																				select="upper-case(substring(.,1,1))" />
398
																		</g>
399
																		<xsl:value-of select="substring(.,2)" />
400
																	</xsl:copy>
401
																</xsl:when>
402
																<xsl:otherwise>
403
																	<xsl:copy-of select="." />
404
																</xsl:otherwise>
405
															</xsl:choose>
406
														</xsl:for-each>
407
													</expan>
408
												</xsl:when>
409
												<xsl:otherwise>
410
													<xsl:copy-of select="$expannocap" />
411
												</xsl:otherwise>
412
											</xsl:choose>
413
										</xsl:variable>
414
										<xsl:choose>
415
											<xsl:when test="matches($abbr,'.+')">
416
												<choice xmlns="http://www.tei-c.org/ns/1.0">
417
													<abbr xmlns="http://www.tei-c.org/ns/1.0">
418
														<xsl:copy-of select="$abbr" />
419
													</abbr>
420
													<xsl:copy-of select="$expan" />
421
												</choice>
422
											</xsl:when>
423
											<xsl:otherwise>
424
												<xsl:copy-of select="$expan" /><!--<xsl:comment>Unknown 
425
													abbr!</xsl:comment> -->
426
											</xsl:otherwise>
427
										</xsl:choose>
428
										<xsl:value-of select="$nextLetter" />
429
									</xsl:matching-substring>
430
									<xsl:non-matching-substring>
431
										<xsl:copy-of select="." /><!--<xsl:comment>Unknown 
432
											abbr-expan!</xsl:comment> -->
433
									</xsl:non-matching-substring>
434
								</xsl:analyze-string>
435
							</xsl:when>
436
							<xsl:when test="matches(.,'#\*([ij])')">
437
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j">
438
									<xsl:value-of select="upper-case(regex-group(1))" />
439
								</g>
440
							</xsl:when>
441
							<xsl:when test="matches(.,'#\*([uv])')">
442
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v">
443
									<xsl:value-of select="upper-case(regex-group(1))" />
444
								</g>
445
							</xsl:when>
446
							<xsl:when test="matches(.,'\*í')">
447
								<g xmlns="http://www.tei-c.org/ns/1.0"
448
									ana="ori:dipl-i ori:facs-iacute">j</g>
449
							</xsl:when>
450
							<xsl:when test="matches(.,'\*([ij])')">
451
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j">
452
									<xsl:value-of select="regex-group(1)" />
453
								</g>
454
							</xsl:when>
455
							<xsl:when test="matches(.,'\*([uv])')">
456
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v">
457
									<xsl:value-of select="regex-group(1)" />
458
								</g>
459
							</xsl:when>
460
							<xsl:when test="matches(.,'#\*([IJ])')">
461
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I">
462
									<xsl:value-of select="lower-case(regex-group(1))" />
463
								</g>
464
							</xsl:when>
465
							<xsl:when test="matches(.,'#\*([UV])')">
466
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V">
467
									<xsl:value-of select="lower-case(regex-group(1))" />
468
								</g>
469
							</xsl:when>
470
							<xsl:when test="matches(.,'\*([IJ])')">
471
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I">
472
									<xsl:value-of select="regex-group(1)" />
473
								</g>
474
							</xsl:when>
475
							<xsl:when test="matches(.,'\*([UV])')">
476
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V">
477
									<xsl:value-of select="regex-group(1)" />
478
								</g>
479
							</xsl:when>
480
							<xsl:when test="matches(.,'#ſ')">
481
								<xsl:analyze-string select="." regex="^#(.)">
482
									<xsl:matching-substring>
483
										<g xmlns="http://www.tei-c.org/ns/1.0"
484
											ana="ori:dipl-caps ori:facs-slong">S</g>
485
									</xsl:matching-substring>
486
								</xsl:analyze-string>
487
							</xsl:when>
488
							<!--  -->
489
							<!-- <xsl:when test="matches(.,'#')"> <xsl:analyze-string select="." 
490
								regex="^#(.)"> <xsl:matching-substring> <choice xmlns="http://www.tei-c.org/ns/1.0"> 
491
								<abbr xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(1)"/></abbr> 
492
								<expan xmlns="http://www.tei-c.org/ns/1.0"><ex xmlns="http://www.tei-c.org/ns/1.0"><g 
493
								xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small">E</g>t</ex></expan> 
494
								</choice> </xsl:matching-substring> </xsl:analyze-string> </xsl:when> -->
495
							<xsl:when test="matches(.,'#[A-Z]')">
496
								<xsl:analyze-string select="." regex="^#(.)">
497
									<xsl:matching-substring>
498
										<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-caps">
499
											<xsl:value-of
500
												select="lower-case(regex-group(1))" />
501
										</g>
502
									</xsl:matching-substring>
503
								</xsl:analyze-string>
504
							</xsl:when>
505
							<xsl:when test="matches(.,'#[^(]')">
506
								<xsl:analyze-string select="."
507
									regex="^#(.+)$">
508
									<xsl:matching-substring>
509
										<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small">
510
											<xsl:value-of
511
												select="upper-case(regex-group(1))" />
512
										</g>
513
									</xsl:matching-substring>
514
								</xsl:analyze-string>
515
							</xsl:when>
516
							<xsl:when test="matches(.,'\{\{([^}}]+)\}\}')">
517
								<xsl:analyze-string select="."
518
									regex="^\{{\{{([^:]*):([^:]*):([^:]*):([^:]*):?([^:]*)\}}\}}$">
519
									<xsl:matching-substring>
520
										<xsl:variable name="lettrine">
521
											<xsl:value-of select="regex-group(1)" />
522
										</xsl:variable>
523
										<xsl:variable name="size">
524
											<xsl:value-of select="regex-group(2)" />
525
										</xsl:variable>
526
										<xsl:variable name="sizeAct">
527
											<xsl:value-of select="regex-group(3)" />
528
										</xsl:variable>
529
										<xsl:variable name="color">
530
											<xsl:value-of select="regex-group(4)" />
531
										</xsl:variable>
532
										<xsl:variable name="deco">
533
											<xsl:value-of select="regex-group(5)" />
534
										</xsl:variable>
535
										<xsl:variable name="rend">
536
											<xsl:value-of select="concat('size(',$size,')')" />
537
											<xsl:if test="matches($sizeAct,'.+')">
538
												<xsl:value-of
539
													select="concat(' sizeAct(',$sizeAct,')')" />
540
											</xsl:if>
541
											<xsl:if test="matches($color,'.+')">
542
												<xsl:value-of
543
													select="concat(' color(',$color,')')" />
544
											</xsl:if>
545
											<xsl:if test="matches($deco,'.+')">
546
												<xsl:value-of
547
													select="concat(' deco(',$deco,')')" />
548
											</xsl:if>
549
										</xsl:variable>
550
										<g xmlns="http://www.tei-c.org/ns/1.0" type="lettrine"
551
											rend="{$rend}">
552
											<xsl:value-of select="$lettrine" />
553
										</g>
554
									</xsl:matching-substring>
555
								</xsl:analyze-string>
556
							</xsl:when>
557

  
558
							<xsl:when test="matches(.,'__')">
559
								<space xmlns="http://www.tei-c.org/ns/1.0"
560
									ana="ori:figement" />
561
							</xsl:when>
562
							<xsl:when test="matches(.,'_')">
563
								<space xmlns="http://www.tei-c.org/ns/1.0" />
564
							</xsl:when>
565
							<xsl:otherwise>
566
								Match:
567
								<xsl:copy />
568
							</xsl:otherwise>
569
						</xsl:choose>
570
					</xsl:matching-substring>
571
					<xsl:non-matching-substring>
572
						<xsl:copy />
573
					</xsl:non-matching-substring>
574
				</xsl:analyze-string>
575
			</xsl:otherwise>
576
		</xsl:choose>
577
	</xsl:template>
578

  
579

  
580

  
395 581
</xsl:stylesheet>

Also available in: Unified diff