Révision 729
tmp/trunk/org.txm.setups/shared/all/xsl/txm-edition-xtz-cuneiform.xsl (revision 729) | ||
---|---|---|
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" xmlns:txm="http://textometrie.org/1.0" |
|
4 |
exclude-result-prefixes="#all" version="2.0"> |
|
5 |
|
|
6 |
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> |
|
7 |
|
|
8 |
<xsl:strip-space elements="*"/> |
|
9 |
|
|
10 |
<xsl:param name="editionpagetag">pb</xsl:param> |
|
11 |
|
|
12 |
<xsl:param name="textcontainer">text</xsl:param> |
|
13 |
|
|
14 |
<!--<xsl:param name="frontmatter"></xsl:param> |
|
15 |
|
|
16 |
<xsl:param name="backmatter">back</xsl:param>--> |
|
17 |
|
|
18 |
<xsl:variable name="inputtype"> |
|
19 |
<xsl:choose> |
|
20 |
<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when> |
|
21 |
<xsl:otherwise>xmlw</xsl:otherwise> |
|
22 |
</xsl:choose> |
|
23 |
</xsl:variable> |
|
24 |
|
|
25 |
<xsl:template match="/"> |
|
26 |
<html> |
|
27 |
<head> |
|
28 |
<title><xsl:value-of select="//tei:text[1]/@id"/></title> |
|
29 |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> |
|
30 |
</head> |
|
31 |
<body> |
|
32 |
<a class="txm-page" title="1"/> |
|
33 |
<div class="metadata-page"> |
|
34 |
<h1><xsl:value-of select="//tei:text[1]/@id"></xsl:value-of></h1> |
|
35 |
<br/> |
|
36 |
<table> |
|
37 |
<xsl:for-each select="//tei:text[1]/@*"> |
|
38 |
<tr> |
|
39 |
<td><xsl:value-of select="name()"/></td> |
|
40 |
<td><xsl:value-of select="."/></td> |
|
41 |
</tr> |
|
42 |
</xsl:for-each> |
|
43 |
</table> |
|
44 |
<br/> |
|
45 |
<br/> |
|
46 |
</div> |
|
47 |
<xsl:apply-templates select="descendant::*[local-name()=$textcontainer]"/> |
|
48 |
|
|
49 |
|
|
50 |
<!-- <xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto')) and not(following::*[local-name()=$editionpagetag]) and preceding::*[local-name()=$editionpagetag]]"> |
|
51 |
<br/> |
|
52 |
<br/> |
|
53 |
<span class="footnotes"> |
|
54 |
<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto')) and not(following::*[local-name()=$editionpagetag]) and preceding::*[local-name()=$editionpagetag]]"> |
|
55 |
<xsl:variable name="note_count"> |
|
56 |
<xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/> |
|
57 |
</xsl:variable> |
|
58 |
<!-\-<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-\-> |
|
59 |
<span class="note"> |
|
60 |
<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span> |
|
61 |
<xsl:apply-templates mode="#current"/> |
|
62 |
</span> |
|
63 |
</xsl:for-each> |
|
64 |
</span> |
|
65 |
|
|
66 |
</xsl:if> |
|
67 |
--> |
|
68 |
</body> |
|
69 |
</html> |
|
70 |
</xsl:template> |
|
71 |
|
|
72 |
<xsl:template match="//*[local-name()=$textcontainer]"> |
|
73 |
<xsl:variable name="pbcount"></xsl:variable> |
|
74 |
|
|
75 |
<div class="text" style="margin-left:60px;"> |
|
76 |
<xsl:apply-templates/> |
|
77 |
</div> |
|
78 |
</xsl:template> |
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
<xsl:template match="*"> |
|
83 |
<xsl:choose> |
|
84 |
<xsl:when test="descendant::tei:p|descendant::tei:ab"> |
|
85 |
<div> |
|
86 |
<xsl:call-template name="addClass"/> |
|
87 |
<xsl:apply-templates/></div> |
|
88 |
<xsl:text>
</xsl:text> |
|
89 |
</xsl:when> |
|
90 |
<xsl:otherwise><span> |
|
91 |
<xsl:call-template name="addClass"/> |
|
92 |
<xsl:if test="self::tei:add[@del]"> |
|
93 |
<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute> |
|
94 |
</xsl:if> |
|
95 |
<xsl:apply-templates/></span> |
|
96 |
<!--<xsl:call-template name="spacing"/>--> |
|
97 |
</xsl:otherwise> |
|
98 |
</xsl:choose> |
|
99 |
</xsl:template> |
|
100 |
|
|
101 |
<xsl:template match="@*|processing-instruction()|comment()"> |
|
102 |
<!--<xsl:copy/>--> |
|
103 |
</xsl:template> |
|
104 |
|
|
105 |
<!-- <xsl:template match="comment()"> |
|
106 |
<xsl:copy/> |
|
107 |
</xsl:template> |
|
108 |
--> |
|
109 |
<xsl:template match="text()"> |
|
110 |
<xsl:value-of select="normalize-space(.)"/> |
|
111 |
</xsl:template> |
|
112 |
|
|
113 |
<xsl:template name="addClass"> |
|
114 |
<xsl:attribute name="class"> |
|
115 |
<xsl:value-of select="local-name(.)"/> |
|
116 |
<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if> |
|
117 |
<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if> |
|
118 |
<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if> |
|
119 |
</xsl:attribute> |
|
120 |
</xsl:template> |
|
121 |
|
|
122 |
<!-- <xsl:template match="tei:p|tei:ab"> |
|
123 |
<p> |
|
124 |
<xsl:call-template name="addClass"/> |
|
125 |
<xsl:apply-templates/> |
|
126 |
</p> |
|
127 |
<xsl:text>
</xsl:text> |
|
128 |
</xsl:template>--> |
|
129 |
|
|
130 |
<xsl:template match="//word"> |
|
131 |
<xsl:choose> |
|
132 |
<xsl:when test="@line = preceding::word[1]/@line"><xsl:text> </xsl:text></xsl:when> |
|
133 |
<xsl:otherwise><br/><xsl:text>
</xsl:text><span style="position:relative"><span class="linenumber" style="position:absolute;width:40px;left:-50px;padding-right:20px;text-align:right"><xsl:value-of select="@line"/> </span></span></xsl:otherwise> |
|
134 |
</xsl:choose> |
|
135 |
<span> |
|
136 |
<xsl:call-template name="addClass"/> |
|
137 |
<xsl:apply-templates/> |
|
138 |
</span> |
|
139 |
</xsl:template> |
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
<!-- Page breaks --> |
|
144 |
<xsl:template match="//*[local-name()=$editionpagetag]"> |
|
145 |
<xsl:variable name="editionpagetype"> |
|
146 |
<xsl:choose> |
|
147 |
<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when> |
|
148 |
<xsl:otherwise>editionpage</xsl:otherwise> |
|
149 |
</xsl:choose> |
|
150 |
</xsl:variable> |
|
151 |
<xsl:variable name="pagenumber"> |
|
152 |
<xsl:choose> |
|
153 |
<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when> |
|
154 |
<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when> |
|
155 |
<xsl:otherwise>[NN]</xsl:otherwise> |
|
156 |
</xsl:choose> |
|
157 |
</xsl:variable> |
|
158 |
|
|
159 |
<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$editionpagetag])"/></xsl:variable> |
|
160 |
<xsl:if test="@break='no'"><span class="hyphen">-</span></xsl:if> |
|
161 |
<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]"> |
|
162 |
<xsl:text>
</xsl:text> |
|
163 |
<br/> |
|
164 |
<br/> |
|
165 |
<span class="footnotes"> |
|
166 |
<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$editionpagetag][1][count(preceding::*[local-name()=$editionpagetag]) = $page_id]]"> |
|
167 |
<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable> |
|
168 |
<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>--> |
|
169 |
<span class="note"> |
|
170 |
<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span> |
|
171 |
<xsl:apply-templates mode="#current"/> |
|
172 |
</span> |
|
173 |
</xsl:for-each></span><xsl:text>
</xsl:text> |
|
174 |
|
|
175 |
</xsl:if> |
|
176 |
|
|
177 |
<xsl:text>
</xsl:text> |
|
178 |
<br/><xsl:text>
</xsl:text> |
|
179 |
<a class="txm-page" title="{count(preceding::*[local-name()=$editionpagetag]) + 2}"/> |
|
180 |
<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>
</xsl:text> |
|
181 |
</xsl:template> |
|
182 |
|
|
183 |
<!-- Notes --> |
|
184 |
<!-- <xsl:template match="tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]"> |
|
185 |
<!-\-<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-\-> |
|
186 |
<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))]) + 1"/></xsl:variable> |
|
187 |
<a title="{.}" class="noteref" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a> |
|
188 |
<xsl:call-template name="spacing"/> |
|
189 |
</xsl:template> |
|
190 |
--> |
|
191 |
|
|
192 |
<xsl:template match="//w"><span class="w" style="font-family:Santakku"> |
|
193 |
<xsl:variable name="unicode-chars" as="element()"> |
|
194 |
<unicode> |
|
195 |
<xsl:choose> |
|
196 |
<xsl:when test="contains(@ref-unicode,'&')"> |
|
197 |
<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-before(substring(@ref-unicode,4),'&')"/></xsl:with-param></xsl:call-template></char> |
|
198 |
<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-after(@ref-unicode,'&U+')"/></xsl:with-param></xsl:call-template></char> |
|
199 |
</xsl:when> |
|
200 |
<xsl:otherwise><char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(@ref-unicode,4)"/></xsl:with-param></xsl:call-template></char></xsl:otherwise> |
|
201 |
</xsl:choose> |
|
202 |
</unicode> |
|
203 |
</xsl:variable> |
|
204 |
<xsl:if test="@id"> |
|
205 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
|
206 |
</xsl:if> |
|
207 |
<xsl:attribute name="title"> |
|
208 |
<xsl:choose> |
|
209 |
<xsl:when test="descendant::txm:ana"> |
|
210 |
<xsl:for-each select="descendant::txm:ana"> |
|
211 |
<xsl:value-of select="concat(substring(@type,2),': ',.,' ; ')"/> |
|
212 |
</xsl:for-each> |
|
213 |
<xsl:value-of select="concat('translit : ',descendant::txm:form)"/> |
|
214 |
</xsl:when> |
|
215 |
<xsl:otherwise> |
|
216 |
<xsl:for-each select="@*"> |
|
217 |
<xsl:value-of select="concat(name(),': ',.,' ; ')"/> |
|
218 |
</xsl:for-each> |
|
219 |
<xsl:value-of select="concat('translit : ',.)"/> |
|
220 |
</xsl:otherwise> |
|
221 |
</xsl:choose> |
|
222 |
|
|
223 |
</xsl:attribute> |
|
224 |
<xsl:choose> |
|
225 |
<xsl:when test="descendant::txm:form"> |
|
226 |
<xsl:apply-templates select="txm:form"/> |
|
227 |
</xsl:when> |
|
228 |
<xsl:otherwise> |
|
229 |
<!--<xsl:value-of select="codepoints-to-string($unicode)"/>--> |
|
230 |
<xsl:for-each select="$unicode-chars/char"> |
|
231 |
<xsl:value-of select="codepoints-to-string(.)"/> |
|
232 |
</xsl:for-each> |
|
233 |
</xsl:otherwise> |
|
234 |
</xsl:choose> |
|
235 |
|
|
236 |
</span> |
|
237 |
<!--<xsl:if test="following-sibling::tei:w"></xsl:if>--> |
|
238 |
</xsl:template> |
|
239 |
|
|
240 |
<xsl:template name="hex2num"> |
|
241 |
<xsl:param name="hex"/> |
|
242 |
<xsl:param name="num" select="0"/> |
|
243 |
<xsl:param name="MSB" select="translate(substring($hex, 1, 1), 'abcdef', 'ABCDEF')"/> |
|
244 |
<xsl:param name="value" select="string-length(substring-before('0123456789ABCDEF', $MSB))"/> |
|
245 |
<xsl:param name="result" select="16 * $num + $value"/> |
|
246 |
<xsl:choose> |
|
247 |
<xsl:when test="string-length($hex) > 1"> |
|
248 |
<xsl:call-template name="hex2num"> |
|
249 |
<xsl:with-param name="hex" select="substring($hex, 2)"/> |
|
250 |
<xsl:with-param name="num" select="$result"/> |
|
251 |
</xsl:call-template> |
|
252 |
</xsl:when> |
|
253 |
<xsl:otherwise> |
|
254 |
<xsl:value-of select="$result"/> |
|
255 |
</xsl:otherwise> |
|
256 |
</xsl:choose> |
|
257 |
</xsl:template> |
|
258 |
|
|
259 |
|
|
260 |
<xsl:template match="//txm:form"> |
|
261 |
<xsl:variable name="unicode-chars" as="element()"> |
|
262 |
<unicode> |
|
263 |
<xsl:choose> |
|
264 |
<xsl:when test="contains(following-sibling::txm:ana[@type='#ref-unicode'],'&')"> |
|
265 |
<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-before(substring(following-sibling::txm:ana[@type='#ref-unicode'],4),'&')"/></xsl:with-param></xsl:call-template></char> |
|
266 |
<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-after(following-sibling::txm:ana[@type='#ref-unicode'],'&U+')"/></xsl:with-param></xsl:call-template></char> |
|
267 |
</xsl:when> |
|
268 |
<xsl:otherwise><char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(following-sibling::txm:ana[@type='#ref-unicode'],4)"/></xsl:with-param></xsl:call-template></char></xsl:otherwise> |
|
269 |
</xsl:choose> |
|
270 |
</unicode> |
|
271 |
</xsl:variable> |
|
272 |
<!--<xsl:variable name="unicode"> |
|
273 |
<xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="ancestor::w/substring(child::txm:ana[@type='#ref-unicode'],4)"/></xsl:with-param></xsl:call-template> |
|
274 |
</xsl:variable>--> |
|
275 |
|
|
276 |
<!--<xsl:value-of select="codepoints-to-string($unicode)"/>--> |
|
277 |
<xsl:for-each select="$unicode-chars/char"> |
|
278 |
<xsl:value-of select="codepoints-to-string(.)"/> |
|
279 |
<!--<xsl:value-of select="."/>--> |
|
280 |
</xsl:for-each> |
|
281 |
</xsl:template> |
|
282 |
|
|
283 |
<!-- <xsl:template name="spacing"> |
|
284 |
<xsl:choose> |
|
285 |
<xsl:when test="$inputtype='xmltxm'"> |
|
286 |
<xsl:call-template name="spacing-xmltxm"/> |
|
287 |
</xsl:when> |
|
288 |
<xsl:otherwise> |
|
289 |
<xsl:call-template name="spacing-xmlw"/> |
|
290 |
</xsl:otherwise> |
|
291 |
</xsl:choose> |
|
292 |
</xsl:template> |
|
293 |
|
|
294 |
<xsl:template name="spacing-xmlw"> |
|
295 |
<xsl:choose> |
|
296 |
<xsl:when test="ancestor::tei:w"/> |
|
297 |
<xsl:when test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]"/> |
|
298 |
<xsl:when test="matches(.,'^\s*[(\[]+$|\w(''|’)\s*$')"></xsl:when> |
|
299 |
<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when> |
|
300 |
<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when> |
|
301 |
<xsl:when test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]"> |
|
302 |
<xsl:text> </xsl:text> |
|
303 |
</xsl:when> |
|
304 |
<xsl:otherwise> |
|
305 |
<xsl:text> </xsl:text> |
|
306 |
</xsl:otherwise> |
|
307 |
</xsl:choose> |
|
308 |
</xsl:template> |
|
309 |
|
|
310 |
<xsl:template name="spacing-xmltxm"> |
|
311 |
<xsl:choose> |
|
312 |
<xsl:when test="ancestor::tei:w"/> |
|
313 |
<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]"/> |
|
314 |
<xsl:when test="matches(descendant::txm:form[1],'^[(\[]+$|\w(''|’)$')"></xsl:when> |
|
315 |
<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when> |
|
316 |
<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when> |
|
317 |
<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]"> |
|
318 |
<xsl:text> </xsl:text> |
|
319 |
</xsl:when> |
|
320 |
<xsl:otherwise> |
|
321 |
<xsl:text> </xsl:text> |
|
322 |
</xsl:otherwise> |
|
323 |
</xsl:choose> |
|
324 |
</xsl:template>--> |
|
325 |
|
|
326 |
|
|
327 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/filter-out-sp.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet |
|
3 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
4 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
6 |
exclude-result-prefixes="tei edate xd" version="2.0"> |
|
7 |
|
|
8 |
<xd:doc type="stylesheet"> |
|
9 |
<xd:short> |
|
10 |
Feuille de style de suppression de certains éléments XML à utiliser comme |
|
11 |
prétraitement de l'import XML/w+CSV. |
|
12 |
</xd:short> |
|
13 |
<xd:detail> |
|
14 |
This stylesheet is free software; you can redistribute it and/or |
|
15 |
modify it under the terms of the GNU Lesser General Public |
|
16 |
License as published by the Free Software Foundation; either |
|
17 |
version 3 of the License, or (at your option) any later version. |
|
18 |
|
|
19 |
This stylesheet is distributed in the hope that it will be useful, |
|
20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
22 |
Lesser General Public License for more details. |
|
23 |
|
|
24 |
You should have received a copy of GNU Lesser Public License with |
|
25 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
|
26 |
</xd:detail> |
|
27 |
<xd:author>Serge Heiden slh@ens-lyon.fr</xd:author> |
|
28 |
<xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright> |
|
29 |
</xd:doc> |
|
30 |
|
|
31 |
|
|
32 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/> |
|
33 |
|
|
34 |
<xsl:template match="@*|node()"> |
|
35 |
<xsl:copy> |
|
36 |
<xsl:apply-templates select="@*|node()" /> |
|
37 |
</xsl:copy> |
|
38 |
</xsl:template> |
|
39 |
|
|
40 |
<!-- On supprime tous les <sp> dont l'attribut @who vaut 'enqueteur' --> |
|
41 |
|
|
42 |
<xsl:template match="//sp[@who='enqueteur']"> |
|
43 |
<!--<xsl:copy-of select="."/>--> |
|
44 |
</xsl:template> |
|
45 |
|
|
46 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-filter-teitextgrid-xmlw-posttok.xsl (revision 729) | ||
---|---|---|
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:xd="http://www.pnp-software.com/XSLTdoc" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:txm="http://textometrie.org/1.0" |
|
4 |
exclude-result-prefixes="tei edate txm" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0"> |
|
5 |
|
|
6 |
<xd:doc type="stylesheet"> |
|
7 |
<xd:short> |
|
8 |
This stylesheet is used on tokenized DARIAH-DE TextGrid files |
|
9 |
in the TXM XML/w + csv import process. |
|
10 |
</xd:short> |
|
11 |
<xd:detail> |
|
12 |
This stylesheet is free software; you can redistribute it and/or |
|
13 |
modify it under the terms of the GNU Lesser General Public |
|
14 |
License as published by the Free Software Foundation; either |
|
15 |
version 3 of the License, or (at your option) any later version. |
|
16 |
|
|
17 |
This stylesheet is distributed in the hope that it will be useful, |
|
18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
20 |
Lesser General Public License for more details. |
|
21 |
|
|
22 |
You should have received a copy of GNU Lesser Public License with |
|
23 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
|
24 |
</xd:detail> |
|
25 |
<xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author> |
|
26 |
<xd:copyright>2014, CNRS / ICAR (CACTUS)</xd:copyright> |
|
27 |
</xd:doc> |
|
28 |
|
|
29 |
|
|
30 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> |
|
31 |
|
|
32 |
<!-- By default, copy all attributes, comments, processing instructions and text nodes --> |
|
33 |
|
|
34 |
<xsl:template match="@*|comment()|processing-instruction()"> |
|
35 |
<xsl:copy/> |
|
36 |
</xsl:template> |
|
37 |
|
|
38 |
<xsl:template match="text()"> |
|
39 |
<xsl:value-of select="."/> |
|
40 |
</xsl:template> |
|
41 |
|
|
42 |
<!-- delete the teiHeader for xml/w import module--> |
|
43 |
|
|
44 |
<xsl:template match="teiHeader"/> |
|
45 |
|
|
46 |
|
|
47 |
<!-- The page breaks must be placed before the structural units (text divions) that |
|
48 |
start on a given page (to avoid empty elements creation when splitting the pages of the |
|
49 |
TXM edition) --> |
|
50 |
|
|
51 |
<xsl:template match="text"> |
|
52 |
<xsl:copy> |
|
53 |
<xsl:apply-templates select="@*"/> |
|
54 |
<xsl:if test="not(child::*[1][self::pb])"><pb xmlns="http://www.tei-c.org/ns/1.0" n="title"/></xsl:if> |
|
55 |
<xsl:apply-templates/> |
|
56 |
</xsl:copy> |
|
57 |
</xsl:template> |
|
58 |
|
|
59 |
<xsl:template match="*"> |
|
60 |
<xsl:if test="descendant::tei:pb and (parent::tei:text or preceding-sibling::*)"> |
|
61 |
<!-- on déplace les pb initiaux avant la balise de l'élément le plus haut --> |
|
62 |
<xsl:call-template name="raisePb"/> |
|
63 |
</xsl:if> |
|
64 |
<xsl:choose> |
|
65 |
<xsl:when test="namespace-uri()=''"> |
|
66 |
<xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}"> |
|
67 |
<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> |
|
68 |
</xsl:element> |
|
69 |
</xsl:when> |
|
70 |
<xsl:otherwise> |
|
71 |
<xsl:copy> |
|
72 |
<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> |
|
73 |
</xsl:copy> |
|
74 |
</xsl:otherwise> |
|
75 |
</xsl:choose> |
|
76 |
</xsl:template> |
|
77 |
|
|
78 |
<xsl:template match="tei:pb[not(preceding-sibling::*) and not(parent::tei:text)]"> |
|
79 |
<xsl:comment>Pb déplacé plus haut</xsl:comment> |
|
80 |
</xsl:template> |
|
81 |
|
|
82 |
<xsl:template name="raisePb"> |
|
83 |
<xsl:if test="descendant::tei:pb"> |
|
84 |
<xsl:for-each select="child::*[1][descendant-or-self::tei:pb]"> |
|
85 |
<xsl:choose> |
|
86 |
<xsl:when test="self::tei:pb"><xsl:comment>Pb remonté</xsl:comment> |
|
87 |
<xsl:copy> |
|
88 |
<xsl:apply-templates select="@*"/> |
|
89 |
<xsl:if test="not(@n) and not(@facs) and following-sibling::tei:fw[1 or 2][@type='pageNum']"> |
|
90 |
<xsl:attribute name="n"><xsl:value-of select="normalize-space(following-sibling::tei:fw[@type='pageNum'][1])"/></xsl:attribute> |
|
91 |
</xsl:if> |
|
92 |
</xsl:copy></xsl:when> |
|
93 |
<xsl:otherwise><xsl:call-template name="raisePb"></xsl:call-template></xsl:otherwise> |
|
94 |
</xsl:choose> |
|
95 |
</xsl:for-each> |
|
96 |
</xsl:if> |
|
97 |
</xsl:template> |
|
98 |
|
|
99 |
|
|
100 |
<!-- add @ref to words (for concordances) --> |
|
101 |
|
|
102 |
<xsl:variable name="filename"> |
|
103 |
<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$"> |
|
104 |
<xsl:matching-substring> |
|
105 |
<xsl:value-of select="regex-group(2)"/> |
|
106 |
</xsl:matching-substring> |
|
107 |
</xsl:analyze-string> |
|
108 |
</xsl:variable> |
|
109 |
|
|
110 |
<xsl:template match="w"> |
|
111 |
<xsl:variable name="ref"> |
|
112 |
<xsl:choose> |
|
113 |
<xsl:when test="preceding::pb[1][@n]"> |
|
114 |
<xsl:value-of select="concat($filename,', p. ',preceding::pb[1]/@n)"/> |
|
115 |
</xsl:when> |
|
116 |
<xsl:otherwise><xsl:value-of select="$filename"/></xsl:otherwise> |
|
117 |
</xsl:choose> |
|
118 |
</xsl:variable> |
|
119 |
<w xmlns="http://www.tei-c.org/ns/1.0" ref="{$ref}"> |
|
120 |
<xsl:apply-templates select="@*"/> |
|
121 |
<xsl:apply-templates select="*|processing-instruction()|comment()|text()"/> |
|
122 |
</w> |
|
123 |
</xsl:template> |
|
124 |
|
|
125 |
<!-- transform speaker into an attribute of the sp element --> |
|
126 |
|
|
127 |
<xsl:template match="sp"> |
|
128 |
<xsl:copy> |
|
129 |
<xsl:if test="child::speaker"> |
|
130 |
<xsl:variable name="who"> |
|
131 |
<xsl:value-of select="speaker"/> |
|
132 |
</xsl:variable> |
|
133 |
<xsl:attribute name="who"><xsl:value-of select="normalize-space(replace($who,'\s*\p{P}+\s*$',''))"/></xsl:attribute> |
|
134 |
<xsl:apply-templates/> |
|
135 |
</xsl:if> |
|
136 |
</xsl:copy> |
|
137 |
</xsl:template> |
|
138 |
|
|
139 |
<xsl:template match="speaker"/> |
|
140 |
|
|
141 |
|
|
142 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-edition-xmltxm-textgrid.xsl (revision 729) | ||
---|---|---|
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" xmlns:txm="http://textometrie.org/1.0" |
|
4 |
exclude-result-prefixes="#all" version="2.0"> |
|
5 |
|
|
6 |
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> |
|
7 |
|
|
8 |
<xsl:strip-space elements="*"/> |
|
9 |
|
|
10 |
<xsl:template match="/"> |
|
11 |
<html> |
|
12 |
<head> |
|
13 |
<title><xsl:value-of select="//tei:text[1]/@id"/></title> |
|
14 |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> |
|
15 |
<link rel="stylesheet" media="all" type="text/css" href="css/txm-textgrid.css" /> |
|
16 |
<style type="text/css"> |
|
17 |
.verseline:before { |
|
18 |
position:absolute; |
|
19 |
left:-50px; |
|
20 |
top:-14px; |
|
21 |
width:25px; |
|
22 |
text-align:right; |
|
23 |
color:gray; |
|
24 |
content:attr(title); |
|
25 |
} |
|
26 |
.editionpage { |
|
27 |
page-break-before:always; |
|
28 |
color:gray; |
|
29 |
display:block; |
|
30 |
text-align:center; |
|
31 |
} |
|
32 |
.editionpageverse { |
|
33 |
position:relative; |
|
34 |
left:-5%; |
|
35 |
page-break-before:always; |
|
36 |
color:gray; |
|
37 |
display:block; |
|
38 |
text-align:center; |
|
39 |
} |
|
40 |
.noteinline { |
|
41 |
color:gray; |
|
42 |
} |
|
43 |
.head { |
|
44 |
color:indigo; |
|
45 |
font-weight:bold; |
|
46 |
} |
|
47 |
.speaker { |
|
48 |
color:darkblue; |
|
49 |
} |
|
50 |
</style> |
|
51 |
<!-- <title> |
|
52 |
<xsl:if test="$author[not(contains(.,'anonym'))]"> |
|
53 |
<xsl:value-of select="$author"/><xsl:text> : </xsl:text> |
|
54 |
</xsl:if> |
|
55 |
<xsl:value-of select="$title-normal"/> |
|
56 |
</title> --> |
|
57 |
</head> |
|
58 |
<xsl:apply-templates select="descendant::tei:text"/> |
|
59 |
</html> |
|
60 |
</xsl:template> |
|
61 |
|
|
62 |
<xsl:template match="tei:text"> |
|
63 |
<body> |
|
64 |
<a class="txm-page" title="1"> </a> |
|
65 |
<div class="metadata-page"> |
|
66 |
<h1><xsl:value-of select="@id"></xsl:value-of></h1> |
|
67 |
<br/> |
|
68 |
<table> |
|
69 |
<xsl:for-each select="@*"> |
|
70 |
<tr> |
|
71 |
<td><xsl:value-of select="name()"/></td> |
|
72 |
<td><xsl:value-of select="."/></td> |
|
73 |
</tr> |
|
74 |
</xsl:for-each> |
|
75 |
</table> |
|
76 |
</div> |
|
77 |
<xsl:apply-templates/> |
|
78 |
</body> |
|
79 |
</xsl:template> |
|
80 |
|
|
81 |
<xsl:template match="*"> |
|
82 |
<xsl:choose> |
|
83 |
<xsl:when test="descendant::tei:p|descendant::tei:ab|descendant::tei:lg"> |
|
84 |
<div> |
|
85 |
<xsl:call-template name="addClass"/> |
|
86 |
<xsl:call-template name="checkId"/> |
|
87 |
<xsl:apply-templates/></div> |
|
88 |
<xsl:text>
</xsl:text> |
|
89 |
</xsl:when> |
|
90 |
<xsl:otherwise><span> |
|
91 |
<xsl:call-template name="addClass"/> |
|
92 |
<xsl:call-template name="checkId"/> |
|
93 |
<!-- <xsl:if test="self::tei:add[@del]"> |
|
94 |
<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute> |
|
95 |
</xsl:if>--> |
|
96 |
<xsl:apply-templates/></span> |
|
97 |
<xsl:call-template name="spacing-xmltxm"/> |
|
98 |
</xsl:otherwise> |
|
99 |
</xsl:choose> |
|
100 |
</xsl:template> |
|
101 |
|
|
102 |
<xsl:template match="@*|processing-instruction()|comment()"> |
|
103 |
<!--<xsl:copy/>--> |
|
104 |
</xsl:template> |
|
105 |
|
|
106 |
<!-- <xsl:template match="comment()"> |
|
107 |
<xsl:copy/> |
|
108 |
</xsl:template> |
|
109 |
--> |
|
110 |
<xsl:template match="text()"> |
|
111 |
<xsl:value-of select="."/> |
|
112 |
</xsl:template> |
|
113 |
|
|
114 |
<xsl:template name="addClass"> |
|
115 |
<xsl:attribute name="class"> |
|
116 |
<xsl:value-of select="local-name(.)"/> |
|
117 |
<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if> |
|
118 |
<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if> |
|
119 |
<!--<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>--> |
|
120 |
</xsl:attribute> |
|
121 |
</xsl:template> |
|
122 |
|
|
123 |
<xsl:template name="checkId"> |
|
124 |
<xsl:if test="@xml:id"> |
|
125 |
<xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute> |
|
126 |
</xsl:if> |
|
127 |
|
|
128 |
</xsl:template> |
|
129 |
<xsl:template match="tei:p|tei:ab|tei:lg"> |
|
130 |
<p> |
|
131 |
<xsl:call-template name="addClass"/> |
|
132 |
<xsl:call-template name="checkId"/> |
|
133 |
<xsl:apply-templates/> |
|
134 |
</p> |
|
135 |
<xsl:text>
</xsl:text> |
|
136 |
</xsl:template> |
|
137 |
|
|
138 |
<xsl:template match="tei:l"> |
|
139 |
<xsl:if test="preceding-sibling::*"> |
|
140 |
<br/> |
|
141 |
</xsl:if> |
|
142 |
<span class="l"><xsl:apply-templates/></span> |
|
143 |
</xsl:template> |
|
144 |
|
|
145 |
<xsl:template match="tei:head"> |
|
146 |
<xsl:variable name="level"> |
|
147 |
<xsl:value-of select="count(ancestor::tei:div) + 1"/> |
|
148 |
</xsl:variable> |
|
149 |
<xsl:element name="h{$level}"> |
|
150 |
<xsl:call-template name="addClass"/> |
|
151 |
<xsl:call-template name="checkId"/> |
|
152 |
<xsl:apply-templates/> |
|
153 |
</xsl:element> |
|
154 |
<!-- <h2> |
|
155 |
<xsl:call-template name="addClass"/> |
|
156 |
<xsl:apply-templates/> |
|
157 |
</h2>--> |
|
158 |
</xsl:template> |
|
159 |
|
|
160 |
<xsl:template match="//tei:lb"> |
|
161 |
<xsl:variable name="lbcount"> |
|
162 |
<xsl:choose> |
|
163 |
<xsl:when test="ancestor::tei:ab"><xsl:number from="tei:ab" level="any"/></xsl:when> |
|
164 |
<xsl:when test="ancestor::tei:p"><xsl:number from="tei:p" level="any"/></xsl:when> |
|
165 |
<xsl:otherwise>999</xsl:otherwise> |
|
166 |
</xsl:choose> |
|
167 |
</xsl:variable> |
|
168 |
<xsl:if test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]"><br/><xsl:text>
</xsl:text></xsl:if> |
|
169 |
<xsl:if test="@n and not(@rend='prose')"> |
|
170 |
<xsl:choose> |
|
171 |
<xsl:when test="matches(@n,'^[0-9]*[05]$')"> |
|
172 |
<a title="{@n}" class="verseline" style="position:relative"> </a> |
|
173 |
</xsl:when> |
|
174 |
<xsl:when test="matches(@n,'[^0-9]')"> |
|
175 |
<a title="{@n}" class="verseline" style="position:relative"> </a> |
|
176 |
</xsl:when> |
|
177 |
<xsl:otherwise> |
|
178 |
</xsl:otherwise> |
|
179 |
</xsl:choose> |
|
180 |
</xsl:if> |
|
181 |
</xsl:template> |
|
182 |
|
|
183 |
<!-- Page breaks --> |
|
184 |
<xsl:template match="//tei:pb[not(following-sibling::tei:cb)]"> |
|
185 |
<xsl:variable name="editionpagetype"> |
|
186 |
<xsl:choose> |
|
187 |
<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when> |
|
188 |
<xsl:otherwise>editionpage</xsl:otherwise> |
|
189 |
</xsl:choose> |
|
190 |
</xsl:variable> |
|
191 |
<xsl:variable name="pagenumber"> |
|
192 |
<xsl:choose> |
|
193 |
<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when> |
|
194 |
<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when> |
|
195 |
<xsl:otherwise>[NN]</xsl:otherwise> |
|
196 |
</xsl:choose> |
|
197 |
</xsl:variable> |
|
198 |
<xsl:variable name="page_id"><xsl:value-of select="count(preceding::tei:pb)"/></xsl:variable> |
|
199 |
<xsl:if test="//tei:ref[@type='noteAnchor'][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]"> |
|
200 |
<xsl:text>
</xsl:text> |
|
201 |
<br/> |
|
202 |
<br/> |
|
203 |
<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px"> |
|
204 |
<xsl:for-each select="//tei:ref[@type='noteAnchor'][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]"> |
|
205 |
<span class="footnote"> |
|
206 |
<xsl:apply-templates mode="#current" select="id(substring-after(@target,'#'))"/> |
|
207 |
</span> |
|
208 |
</xsl:for-each></span><xsl:text>
</xsl:text> |
|
209 |
|
|
210 |
|
|
211 |
</xsl:if> |
|
212 |
<!-- <xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]"> |
|
213 |
<xsl:text>
</xsl:text> |
|
214 |
<br/> |
|
215 |
<br/> |
|
216 |
<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px"> |
|
217 |
<xsl:for-each select="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::tei:pb[1][count(preceding::tei:pb) = $page_id]]"> |
|
218 |
<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note[not(@place='inline')]) + 1"/></xsl:variable> |
|
219 |
<!-\-<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> <xsl:value-of select="."/></p>-\-> |
|
220 |
<span class="note"> |
|
221 |
<span style="position:absolute;left:-30px"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span> |
|
222 |
<xsl:apply-templates mode="#current"/> |
|
223 |
</span> |
|
224 |
</xsl:for-each></span><xsl:text>
</xsl:text> |
|
225 |
|
|
226 |
</xsl:if>--> |
|
227 |
|
|
228 |
<xsl:text>
</xsl:text> |
|
229 |
<br/><xsl:text>
</xsl:text> |
|
230 |
<a class="txm-page" title="{count(preceding::tei:pb) + 2}"> </a> |
|
231 |
<span class="{$editionpagetype}"> - <xsl:value-of select="$pagenumber"/> - </span><br/><xsl:text>
</xsl:text> |
|
232 |
</xsl:template> |
|
233 |
|
|
234 |
<!-- Notes --> |
|
235 |
<xsl:template match="tei:ref[@type='noteAnchor']"> |
|
236 |
<a title="{id(substring-after(@target,'#'))//txm:form}" style="font-size:75%;position:relative;top:-5px" href="{@target}"><xsl:value-of select="descendant::txm:form"/></a> |
|
237 |
<xsl:call-template name="spacing-xmltxm"/> |
|
238 |
</xsl:template> |
|
239 |
|
|
240 |
|
|
241 |
<xsl:template match="//tei:w"><span class="w"> |
|
242 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
|
243 |
<xsl:attribute name="title"> |
|
244 |
<xsl:if test="ancestor::tei:corr"> |
|
245 |
<xsl:value-of select="concat(' sic : ',descendant::txm:ana[@type='#sic'])"/> |
|
246 |
</xsl:if> |
|
247 |
<xsl:if test="ancestor::tei:reg"> |
|
248 |
<xsl:value-of select="concat(' orig : ',descendant::txm:ana[@type='#orig'])"/> |
|
249 |
</xsl:if> |
|
250 |
<xsl:if test="descendant::txm:ana[matches(@type,'pos$')]"> |
|
251 |
<xsl:for-each select="descendant::txm:ana[matches(@type,'pos$')]"> |
|
252 |
<xsl:value-of select="concat(' ',substring-after(@type,'#'),' : ',.)"/> |
|
253 |
</xsl:for-each> |
|
254 |
</xsl:if> |
|
255 |
</xsl:attribute> |
|
256 |
<!--<xsl:copy-of select="@*"/>--> |
|
257 |
<xsl:apply-templates select="txm:form"/> |
|
258 |
</span><xsl:call-template name="spacing-xmltxm"></xsl:call-template></xsl:template> |
|
259 |
|
|
260 |
<xsl:template match="//txm:form"> |
|
261 |
<xsl:apply-templates/> |
|
262 |
</xsl:template> |
|
263 |
|
|
264 |
|
|
265 |
<xsl:template match="tei:sp[not(descendant::tei:speaker)]"> |
|
266 |
<div class="sp"> |
|
267 |
<span class="speaker"><xsl:value-of select="@who"></xsl:value-of></span> |
|
268 |
<xsl:apply-templates/> |
|
269 |
</div> |
|
270 |
</xsl:template> |
|
271 |
|
|
272 |
|
|
273 |
<xsl:template name="spacing-xmltxm"> |
|
274 |
<xsl:choose> |
|
275 |
<xsl:when test="ancestor::tei:w"/> |
|
276 |
<xsl:when test="following::tei:w[1][matches(descendant::txm:form,'^[.,)\]]+$')]"/> |
|
277 |
<xsl:when test="matches(descendant::txm:form[1],'^[(\[]+$|\w(''|’)$')"></xsl:when> |
|
278 |
<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when> |
|
279 |
<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when> |
|
280 |
<xsl:when test="following::tei:w[1][matches(descendant::txm:form,'^[:;!?]+$')]"> |
|
281 |
<xsl:text> </xsl:text> |
|
282 |
</xsl:when> |
|
283 |
<xsl:otherwise> |
|
284 |
<xsl:text> </xsl:text> |
|
285 |
</xsl:otherwise> |
|
286 |
</xsl:choose> |
|
287 |
</xsl:template> |
|
288 |
|
|
289 |
|
|
290 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/ts2xmlw.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet version="1.0" |
|
3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
4 |
xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
5 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
6 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
7 |
exclude-result-prefixes="edate xd"> |
|
8 |
|
|
9 |
<xd:doc type="stylesheet"> |
|
10 |
|
|
11 |
<xd:short> |
|
12 |
Feuille de transformation du format TIGER-XML vers le format XML-TXM |
|
13 |
</xd:short> |
|
14 |
|
|
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 |
|
|
30 |
<xd:author>Matthieu Decorde, matthieu.decorde AT ens-lyon.fr</xd:author> |
|
31 |
<xd:author>Serge Heiden, slh AT ens-lyon.fr</xd:author> |
|
32 |
<xd:author>Alexey Lavrentev, alexei.lavrentev AT ens-lyon.fr></xd:author> |
|
33 |
|
|
34 |
<xd:copyright>2016, ENS de Lyon/CNRS (UMR IHRIM Cactus)</xd:copyright> |
|
35 |
|
|
36 |
</xd:doc> |
|
37 |
|
|
38 |
<xsl:output |
|
39 |
method="xml" |
|
40 |
encoding="UTF-8" |
|
41 |
indent="yes" /> |
|
42 |
|
|
43 |
<xsl:template match="corpus"> |
|
44 |
<corpus> |
|
45 |
<xsl:choose> |
|
46 |
<xsl:when test="subcorpus"> |
|
47 |
<xsl:apply-templates select="subcorpus"/> |
|
48 |
</xsl:when> |
|
49 |
<xsl:otherwise> |
|
50 |
<text> |
|
51 |
<xsl:apply-templates select="s"/> |
|
52 |
</text> |
|
53 |
</xsl:otherwise> |
|
54 |
</xsl:choose> |
|
55 |
<xsl:apply-templates/> |
|
56 |
</corpus> |
|
57 |
</xsl:template> |
|
58 |
|
|
59 |
<xsl:template match="subcorpus"> |
|
60 |
<text> |
|
61 |
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> |
|
62 |
<xsl:apply-templates select="s"/> |
|
63 |
</text> |
|
64 |
</xsl:template> |
|
65 |
|
|
66 |
<xsl:template match="s"> |
|
67 |
<p> |
|
68 |
<s> |
|
69 |
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> |
|
70 |
<xsl:apply-templates select="graph/terminals/t" /> |
|
71 |
</s> |
|
72 |
</p> |
|
73 |
</xsl:template> |
|
74 |
|
|
75 |
<xsl:template match="t"> |
|
76 |
<w> |
|
77 |
<xsl:for-each select="@*[not(name()='word')]"> |
|
78 |
<xsl:copy/> |
|
79 |
</xsl:for-each> |
|
80 |
<xsl:value-of select="@word"/> |
|
81 |
</w> |
|
82 |
</xsl:template> |
|
83 |
|
|
84 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/filter-out-p.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet |
|
3 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
4 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
6 |
exclude-result-prefixes="tei edate xd" version="2.0"> |
|
7 |
|
|
8 |
<xd:doc type="stylesheet"> |
|
9 |
<xd:short> |
|
10 |
Feuille de style de suppression de certains éléments XML à utiliser comme |
|
11 |
prétraitement de l'import XML/w+CSV. |
|
12 |
</xd:short> |
|
13 |
<xd:detail> |
|
14 |
This stylesheet is free software; you can redistribute it and/or |
|
15 |
modify it under the terms of the GNU Lesser General Public |
|
16 |
License as published by the Free Software Foundation; either |
|
17 |
version 3 of the License, or (at your option) any later version. |
|
18 |
|
|
19 |
This stylesheet is distributed in the hope that it will be useful, |
|
20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
22 |
Lesser General Public License for more details. |
|
23 |
|
|
24 |
You should have received a copy of GNU Lesser Public License with |
|
25 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
|
26 |
</xd:detail> |
|
27 |
<xd:author>Serge Heiden slh@ens-lyon.fr</xd:author> |
|
28 |
<xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright> |
|
29 |
</xd:doc> |
|
30 |
|
|
31 |
|
|
32 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/> |
|
33 |
|
|
34 |
<xsl:template match="@*|node()"> |
|
35 |
<xsl:copy> |
|
36 |
<xsl:apply-templates select="@*|node()" /> |
|
37 |
</xsl:copy> |
|
38 |
</xsl:template> |
|
39 |
|
|
40 |
<!-- On supprime tous les <p> dont l'attribut @type vaut 'ouverture' --> |
|
41 |
|
|
42 |
<xsl:template match="//p[@type='ouverture']"> |
|
43 |
<!--<xsl:copy-of select="."/>--> |
|
44 |
</xsl:template> |
|
45 |
|
|
46 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/identity.xsl (revision 729) | ||
---|---|---|
1 |
<!-- The Identity Transformation --> |
|
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
|
3 |
<!-- Whenever you match any node or any attribute --> |
|
4 |
<xsl:template match="node()|@*"> |
|
5 |
<!-- Copy the current node --> |
|
6 |
<xsl:copy> |
|
7 |
<!-- Including any attributes it has and any child nodes --> |
|
8 |
<xsl:apply-templates select="@*|node()"/> |
|
9 |
</xsl:copy> |
|
10 |
</xsl:template> |
|
11 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-filter-corpusakkadien-xmlw_mots_effaces.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet |
|
3 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
4 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
6 |
exclude-result-prefixes="tei edate xd" version="2.0"> |
|
7 |
|
|
8 |
<xd:doc type="stylesheet"> |
|
9 |
<xd:short> |
|
10 |
Cette feuille de style permet de préparer les transcriptions de tablettes |
|
11 |
d'argile (projet UMR PROCLAC) à l'import XML/W + CSV de TXM en créant les |
|
12 |
propriétés de mots "no-unclear" et "non-supplied" pour éliminer les formes |
|
13 |
non présentes ou peu lisibles dans les sources. |
|
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-2015, CNRS / ICAR (équipe CACTUS)</xd:copyright> |
|
31 |
</xd:doc> |
|
32 |
|
|
33 |
|
|
34 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes"/> |
|
35 |
|
|
36 |
<xsl:template match="@*|*"> |
|
37 |
<xsl:copy> |
|
38 |
<xsl:apply-templates select="@*|node()" /> |
|
39 |
</xsl:copy> |
|
40 |
</xsl:template> |
|
41 |
|
|
42 |
<xsl:template match="@*|*" mode="nosupplied"> |
|
43 |
<xsl:copy> |
|
44 |
<xsl:apply-templates select="@*|node()" /> |
|
45 |
</xsl:copy> |
|
46 |
</xsl:template> |
|
47 |
|
|
48 |
<xsl:template match="@*|*" mode="nounclear"> |
|
49 |
<xsl:copy> |
|
50 |
<xsl:apply-templates select="@*|node()" /> |
|
51 |
</xsl:copy> |
|
52 |
</xsl:template> |
|
53 |
|
|
54 |
<xsl:template match="*[local-name()='teiHeader']"/> |
|
55 |
|
|
56 |
<xsl:template match="text()" mode="#all"> |
|
57 |
<xsl:choose> |
|
58 |
<xsl:when test="ancestor::*[local-name()='w']"> |
|
59 |
<xsl:value-of select="."/> |
|
60 |
</xsl:when> |
|
61 |
<xsl:otherwise/> |
|
62 |
</xsl:choose> |
|
63 |
</xsl:template> |
|
64 |
|
|
65 |
<!-- On supprime les mots qui sont illisibles dans la source et on ajoute une propriété lexicale |
|
66 |
qui correspond à la lisibilité --> |
|
67 |
|
|
68 |
<xsl:template match="//*[local-name()='w']"> |
|
69 |
<xsl:copy> |
|
70 |
<xsl:apply-templates select="@*"/> |
|
71 |
<xsl:attribute name="no-supplied"> |
|
72 |
<xsl:choose> |
|
73 |
<xsl:when test="ancestor::*[local-name()='supplied']">¤</xsl:when> |
|
74 |
<xsl:otherwise><xsl:apply-templates mode="nosupplied"/></xsl:otherwise> |
|
75 |
</xsl:choose> |
|
76 |
</xsl:attribute> |
|
77 |
<xsl:attribute name="no-unclear"> |
|
78 |
<xsl:choose> |
|
79 |
<xsl:when test="ancestor::*[local-name()='supplied'] or ancestor::*[local-name()='unclear']">¤</xsl:when> |
|
80 |
<xsl:otherwise><xsl:apply-templates mode="nounclear"/></xsl:otherwise> |
|
81 |
</xsl:choose> |
|
82 |
</xsl:attribute> |
|
83 |
<xsl:apply-templates/> |
|
84 |
</xsl:copy> |
|
85 |
</xsl:template> |
|
86 |
|
|
87 |
<xsl:template match="*[local-name()='supplied']" mode="nosupplied"/> |
|
88 |
|
|
89 |
<xsl:template match="*[local-name()='supplied']" mode="nounclear"/> |
|
90 |
|
|
91 |
<xsl:template match="*[local-name()='unclear']" mode="nounclear"/> |
|
92 |
|
|
93 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-filter-rnc-xmlw.xsl (revision 729) | ||
---|---|---|
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 |
exclude-result-prefixes="tei edate" version="2.0"> |
|
5 |
|
|
6 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> |
|
7 |
|
|
8 |
<xsl:template match="*"> |
|
9 |
|
|
10 |
<xsl:element name="{local-name(.)}"> |
|
11 |
<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> |
|
12 |
</xsl:element> |
|
13 |
|
|
14 |
</xsl:template> |
|
15 |
|
|
16 |
<xsl:template match="@*|processing-instruction()|comment()"> |
|
17 |
<xsl:copy/> |
|
18 |
</xsl:template> |
|
19 |
|
|
20 |
<xsl:template match="head"/> |
|
21 |
|
|
22 |
<xsl:template match="w"> |
|
23 |
<xsl:element name="w"> |
|
24 |
<xsl:attribute name="lex"><xsl:value-of select="child::ana/@lex"/></xsl:attribute> |
|
25 |
<xsl:attribute name="gr"><xsl:value-of select="child::ana/@gr"/></xsl:attribute> |
|
26 |
<xsl:attribute name="withstress"><xsl:value-of select="normalize-space(child::text())"/></xsl:attribute> |
|
27 |
<xsl:value-of select="replace(child::text(),'`','')"/> |
|
28 |
</xsl:element> |
|
29 |
</xsl:template> |
|
30 |
|
|
31 |
<xsl:template match="text()"> |
|
32 |
<xsl:value-of select="."/> |
|
33 |
</xsl:template> |
|
34 |
|
|
35 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/filter-keep-only-select.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<xsl:stylesheet |
|
3 |
xmlns:xd="http://www.pnp-software.com/XSLTdoc" |
|
4 |
xmlns:edate="http://exslt.org/dates-and-times" |
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
|
6 |
exclude-result-prefixes="tei edate xd" version="2.0"> |
|
7 |
|
|
8 |
<xd:doc type="stylesheet"> |
|
9 |
<xd:short> |
|
10 |
Feuille de style de suppression de tous les éléments XML sauf "select", |
|
11 |
à utiliser comme prétraitement de l'import XML/w+CSV. |
|
12 |
|
|
13 |
Pour changer le nom de la balise à conserver, mettez le nouveau nom |
|
14 |
à la place de "select" dans la balise <xsl:param/> ci-dessous. Vous pouvez |
|
15 |
mettre plusieurs noms en les séparant par une barre verticale. Vous |
|
16 |
pouvez également indiquer le(s) nom(s) de balises à conserver comme un |
|
17 |
paramètre au lancement de cette feuille de style |
|
18 |
|
|
19 |
L'espace de nommage de la balise à conserver n'est pas pris en compte. |
|
20 |
</xd:short> |
|
21 |
<xd:detail> |
|
22 |
This stylesheet is free software; you can redistribute it and/or |
|
23 |
modify it under the terms of the GNU Lesser General Public |
|
24 |
License as published by the Free Software Foundation; either |
|
25 |
version 3 of the License, or (at your option) any later version. |
|
26 |
|
|
27 |
This stylesheet is distributed in the hope that it will be useful, |
|
28 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
29 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
30 |
Lesser General Public License for more details. |
|
31 |
|
|
32 |
You should have received a copy of GNU Lesser Public License with |
|
33 |
this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html |
|
34 |
</xd:detail> |
|
35 |
<xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author> |
|
36 |
<xd:copyright>2013, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright> |
|
37 |
</xd:doc> |
|
38 |
|
|
39 |
|
|
40 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> |
|
41 |
|
|
42 |
<!-- Mettez le nom de la balise à conserver à la place de "select" ci-dessous --> |
|
43 |
<xsl:param name="tagToKeep">select</xsl:param> |
|
44 |
|
|
45 |
<xsl:variable name="tagToKeepStrict"><xsl:value-of select="concat('^',$tagToKeep,'$')"/></xsl:variable> |
|
46 |
|
|
47 |
<xsl:template match="@*|node()"> |
|
48 |
<xsl:copy> |
|
49 |
<xsl:apply-templates select="@*|node()" /> |
|
50 |
</xsl:copy> |
|
51 |
</xsl:template> |
|
52 |
|
|
53 |
|
|
54 |
<xsl:template match="/"> |
|
55 |
<xsl:apply-templates select="processing-instruction()"/> |
|
56 |
<xsl:choose> |
|
57 |
<xsl:when test="descendant::*[matches(local-name(),$tagToKeepStrict)]"> |
|
58 |
<xsl:apply-templates mode="with-select"/> |
|
59 |
</xsl:when> |
|
60 |
<xsl:otherwise> |
|
61 |
<xsl:apply-templates/> |
|
62 |
</xsl:otherwise> |
|
63 |
</xsl:choose> |
|
64 |
</xsl:template> |
|
65 |
|
|
66 |
<xsl:template match="*" mode="with-select"> |
|
67 |
<xsl:choose> |
|
68 |
<xsl:when test="ancestor-or-self::*[matches(local-name(),$tagToKeepStrict)]"> |
|
69 |
<xsl:copy> |
|
70 |
<xsl:apply-templates select="@*|node()"/> |
|
71 |
</xsl:copy> |
|
72 |
</xsl:when> |
|
73 |
<xsl:when test="descendant::*[matches(local-name(),$tagToKeepStrict)]"> |
|
74 |
<xsl:copy> |
|
75 |
<xsl:apply-templates select="@*"/> |
|
76 |
<xsl:apply-templates select="*[descendant-or-self::*[matches(local-name(),$tagToKeepStrict)]]" mode="with-select"/> |
|
77 |
</xsl:copy> |
|
78 |
</xsl:when> |
|
79 |
</xsl:choose> |
|
80 |
</xsl:template> |
|
81 |
|
|
82 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-filter-qgraal_cm-xmlw.xsl (revision 729) | ||
---|---|---|
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:me="http://www.menota.org/ns/1.0" |
|
5 |
xmlns:bfm="http://bfm.ens-lsh.fr/ns/1.0" |
|
6 |
exclude-result-prefixes="tei edate bfm me" version="1.0"> |
|
7 |
|
|
8 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> |
|
9 |
|
|
10 |
<xsl:strip-space elements="me:norm tei:w"/> |
|
11 |
|
|
12 |
<!-- Original version --> |
|
13 |
<!-- <xsl:template match="*"> |
|
14 |
<xsl:choose> |
|
15 |
<xsl:when test="namespace-uri()=''"> |
|
16 |
<xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}"> |
|
17 |
<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> |
|
18 |
</xsl:element> |
|
19 |
</xsl:when> |
|
20 |
<xsl:otherwise> |
|
21 |
<xsl:copy> |
|
22 |
<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> |
|
23 |
</xsl:copy> |
|
24 |
</xsl:otherwise> |
|
25 |
</xsl:choose> |
|
26 |
</xsl:template> |
|
27 |
--> |
|
28 |
<!-- Eliminating all namespaces and comments --> |
|
29 |
<xsl:template match="*"> |
|
30 |
<xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}"> |
|
31 |
<xsl:apply-templates select="*|@*|processing-instruction()|text()"/> |
|
32 |
</xsl:element> |
|
33 |
</xsl:template> |
|
34 |
|
|
35 |
|
|
36 |
<xsl:template match="@*|processing-instruction()"> |
|
37 |
<xsl:copy/> |
|
38 |
</xsl:template> |
|
39 |
|
|
40 |
<xsl:template match="processing-instruction('oxygen')"/> |
|
41 |
|
|
42 |
<xsl:template match="text()"> |
|
43 |
<xsl:value-of select="."/> |
|
44 |
</xsl:template> |
|
45 |
|
|
46 |
<xsl:template match="//tei:TEI"> |
|
47 |
<xsl:element name="TEI" namespace="http://www.tei-c.org/ns/1.0"> |
|
48 |
<xsl:apply-templates/> |
|
49 |
</xsl:element> |
|
50 |
</xsl:template> |
|
51 |
|
|
52 |
<xsl:template match="tei:teiHeader"/> |
|
53 |
|
|
54 |
<xsl:template match="tei:text"> |
|
55 |
<xsl:element name="text" namespace="http://www.tei-c.org/ns/1.0"> |
|
56 |
<xsl:attribute name="idbfm"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='reference']"/></xsl:attribute> |
|
57 |
<!--<xsl:attribute name="deaf"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:idno[@type='sigle_DEAF']"/></xsl:attribute>--> |
|
58 |
<xsl:attribute name="titre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='normal']"/></xsl:attribute> |
|
59 |
<xsl:attribute name="auteur"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author"/></xsl:attribute> |
|
60 |
<xsl:attribute name="siecle"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@n"/></xsl:attribute> |
|
61 |
<xsl:attribute name="ssiecle"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo_sous_siecle']/@n"/></xsl:attribute> |
|
62 |
<xsl:attribute name="datecompolibre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']"/></xsl:attribute> |
|
63 |
<xsl:attribute name="datecompo"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@when"/></xsl:attribute> |
|
64 |
<!--<xsl:attribute name="notbefore"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@notBefore"/></xsl:attribute> |
|
65 |
<xsl:attribute name="notafter"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='compo']/@notAfter"/></xsl:attribute> |
|
66 |
<xsl:attribute name="msdatelibre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']"/></xsl:attribute> |
|
67 |
<xsl:attribute name="msdate"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@when"/></xsl:attribute> |
|
68 |
<xsl:attribute name="msnotbefore"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@notBefore"/></xsl:attribute> |
|
69 |
<xsl:attribute name="msnotafter"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date[@type='ms']/@notAfter"/></xsl:attribute>--> |
|
70 |
<xsl:attribute name="forme"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:catRef/@target[contains(.,'forme')]"/></xsl:attribute> |
|
71 |
<xsl:attribute name="domaine"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:domain/@type"/></xsl:attribute> |
|
72 |
<xsl:attribute name="genre"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/@n"/></xsl:attribute> |
|
73 |
<xsl:attribute name="dialecte"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:region[@type='dialecte_auteur']"/></xsl:attribute> |
|
74 |
<!--<xsl:attribute name="morphosynt"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change[contains(.,'étiquetage morpho')]"/></xsl:attribute> |
|
75 |
<xsl:attribute name="restrictions"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:availability/tei:ab[@type='availability_txmweb']/@subtype"/></xsl:attribute> |
|
76 |
<xsl:attribute name="relation"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textDesc/tei:derivation/@type"/></xsl:attribute> |
|
77 |
<xsl:attribute name="edsci"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:titleStmt/tei:respStmt[contains(.,'Éditeur scientifique')]/tei:name"/></xsl:attribute> |
|
78 |
<xsl:attribute name="edcomm"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:publisher"/></xsl:attribute> |
|
79 |
<xsl:attribute name="edville"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:pubPlace"/></xsl:attribute> |
|
80 |
<xsl:attribute name="eddate"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:publicationStmt/tei:date"/></xsl:attribute> |
|
81 |
<xsl:attribute name="ednum"><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:biblFull/tei:editionStmt/tei:edition"/></xsl:attribute>--> |
|
82 |
<xsl:apply-templates/> |
|
83 |
</xsl:element> |
|
84 |
</xsl:template> |
|
85 |
|
|
86 |
<xsl:template match="//tei:w"> |
|
87 |
<xsl:element name="w" namespace="http://www.tei-c.org/ns/1.0"> |
|
88 |
<xsl:apply-templates select="@*[not(name()='type')]"/> |
|
89 |
<xsl:attribute name="pos"><xsl:value-of select="@type"/></xsl:attribute> |
|
90 |
<xsl:attribute name="dipl"><xsl:apply-templates select="descendant::me:dipl"/></xsl:attribute> |
|
91 |
<xsl:attribute name="ref"><xsl:value-of select="concat('graal_cm, col. ',substring-after(preceding::tei:cb[1]/@xml:id,'col_'),', l. ',preceding::tei:lb[1]/@n)"/></xsl:attribute> |
|
92 |
<xsl:attribute name="q"> |
|
93 |
<xsl:value-of select="count(ancestor::tei:q)"/> |
|
94 |
</xsl:attribute> |
|
95 |
<xsl:apply-templates/> |
|
96 |
</xsl:element> |
|
97 |
</xsl:template> |
|
98 |
|
|
99 |
<xsl:template match="//tei:choice[parent::tei:w]"> |
|
100 |
<xsl:choose> |
|
101 |
<xsl:when test="descendant::me:norm"> |
|
102 |
<xsl:apply-templates select="me:norm"/> |
|
103 |
</xsl:when> |
|
104 |
<xsl:otherwise> |
|
105 |
<xsl:apply-templates select="me:facs"/> |
|
106 |
</xsl:otherwise> |
|
107 |
</xsl:choose> |
|
108 |
</xsl:template> |
|
109 |
|
|
110 |
<xsl:template match="me:dipl"> |
|
111 |
<xsl:for-each select="child::node()"> |
|
112 |
<xsl:choose> |
|
113 |
<xsl:when test="self::tei:ex"> |
|
114 |
<xsl:value-of select="concat('‹',.,'›')"/> |
|
115 |
</xsl:when> |
|
116 |
<xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise> |
|
117 |
</xsl:choose> |
|
118 |
</xsl:for-each> |
|
119 |
</xsl:template> |
|
120 |
|
|
121 |
|
|
122 |
<xsl:template match="//tei:choice[descendant::tei:w]"> |
|
123 |
<xsl:apply-templates select="tei:corr|tei:reg"/> |
|
124 |
</xsl:template> |
|
125 |
|
|
126 |
<xsl:template match="//tei:surplus"/> |
|
127 |
|
|
128 |
<xsl:template match="//tei:del"/> |
|
129 |
|
|
130 |
<xsl:template match="//tei:note"/> |
|
131 |
|
|
132 |
<xsl:variable name="apostrophe" select='"'"'/> |
|
133 |
|
|
134 |
<xsl:template match="@bfm:aggl"> |
|
135 |
<xsl:attribute name="rend"><xsl:value-of select="."/></xsl:attribute> |
|
136 |
</xsl:template> |
|
137 |
|
|
138 |
<xsl:template match="me:norm|me:facs"> |
|
139 |
<xsl:apply-templates/> |
|
140 |
<!-- added 2011-02-10 --> |
|
141 |
<xsl:if test="ancestor::tei:w[@*='elision'] and not(substring(., string-length(.))=$apostrophe)"> |
|
142 |
<xsl:text>'</xsl:text> |
|
143 |
</xsl:if> |
|
144 |
</xsl:template> |
|
145 |
|
|
146 |
<!-- <xsl:template match="tei:milestone[@unit='column']"> |
|
147 |
<xsl:element name="pb" namespace="http://www.tei-c.org/ns/1.0"> |
|
148 |
<xsl:attribute name="n"><xsl:value-of select="substring-after(@xml:id,'col_')"/></xsl:attribute> |
|
149 |
</xsl:element> |
|
150 |
</xsl:template> |
|
151 |
|
|
152 |
<xsl:template match="tei:pb[@ed='#Pauphilet1923']"> |
|
153 |
<xsl:element name="milestone" namespace="http://www.tei-c.org/ns/1.0"> |
|
154 |
<xsl:attribute name="unit">page-Pauphilet</xsl:attribute> |
|
155 |
<xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute> |
|
156 |
</xsl:element> |
|
157 |
</xsl:template>--> |
|
158 |
|
|
159 |
<xsl:template match="tei:cb[@rend='hidden']"/> |
|
160 |
|
|
161 |
<xsl:template match="tei:cb[not(@rend='hidden')]"> |
|
162 |
<xsl:element name="pb" namespace="http://www.tei-c.org/ns/1.0"> |
|
163 |
<xsl:attribute name="n"><xsl:value-of select="substring-after(@xml:id,'col_')"/></xsl:attribute> |
|
164 |
</xsl:element> |
|
165 |
</xsl:template> |
|
166 |
|
|
167 |
<xsl:template match="tei:pb"/> |
|
168 |
|
|
169 |
|
|
170 |
<xsl:template match="bfm:sb"/> |
|
171 |
|
|
172 |
<xsl:template match="tei:lb[@ed='#facs']"/> |
|
173 |
|
|
174 |
|
|
175 |
</xsl:stylesheet> |
tmp/trunk/org.txm.setups/shared/all/xsl/txm-edition-page-split.xsl (revision 729) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<xsl:stylesheet |
|
3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
4 |
version="2.0" xpath-default-namespace="http://www.w3.org/1999/xhtml"> |
|
5 |
<!-- |
|
6 |
This software is dual-licensed: |
|
7 |
|
|
8 |
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0 |
|
9 |
Unported License http://creativecommons.org/licenses/by-sa/3.0/ |
|
10 |
|
|
11 |
2. http://www.opensource.org/licenses/BSD-2-Clause |
|
12 |
|
|
13 |
All rights reserved. |
|
14 |
|
|
15 |
Redistribution and use in source and binary forms, with or without |
|
16 |
modification, are permitted provided that the following conditions are |
|
17 |
met: |
|
18 |
|
|
19 |
* Redistributions of source code must retain the above copyright |
|
20 |
notice, this list of conditions and the following disclaimer. |
|
21 |
|
|
22 |
* Redistributions in binary form must reproduce the above copyright |
|
23 |
notice, this list of conditions and the following disclaimer in the |
|
24 |
documentation and/or other materials provided with the distribution. |
|
25 |
|
|
26 |
This software is provided by the copyright holders and contributors |
|
27 |
"as is" and any express or implied warranties, including, but not |
|
28 |
limited to, the implied warranties of merchantability and fitness for |
|
29 |
a particular purpose are disclaimed. In no event shall the copyright |
|
30 |
holder or contributors be liable for any direct, indirect, incidental, |
|
31 |
special, exemplary, or consequential damages (including, but not |
|
32 |
limited to, procurement of substitute goods or services; loss of use, |
|
33 |
data, or profits; or business interruption) however caused and on any |
|
34 |
theory of liability, whether in contract, strict liability, or tort |
|
35 |
(including negligence or otherwise) arising in any way out of the use |
|
36 |
of this software, even if advised of the possibility of such damage. |
|
37 |
|
|
38 |
$Id$ |
|
39 |
|
|
40 |
This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz |
|
41 |
available at |
|
42 |
https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl |
|
43 |
and is adapted by Alexei Lavrentiev to split an HTML edition for |
|
44 |
TXM platform. |
|
45 |
|
|
46 |
--> |
|
47 |
<xsl:output indent="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> |
|
48 |
|
|
49 |
<xsl:param name="cssname-txm">txm</xsl:param> |
|
50 |
<xsl:param name="cssname">tei</xsl:param> |
|
51 |
<xsl:param name="editionname">default</xsl:param> |
|
52 |
|
|
53 |
<xsl:template match="html/body"> |
|
54 |
<xsl:variable name="pages"> |
|
55 |
<xsl:copy> |
|
56 |
<xsl:apply-templates select="@*"/> |
|
57 |
<xsl:apply-templates |
|
58 |
select="*|processing-instruction()|comment()|text()"/> |
|
59 |
</xsl:copy> |
|
60 |
</xsl:variable> |
|
61 |
<xsl:for-each select="$pages"> |
|
62 |
<xsl:apply-templates mode="pass2"/> |
|
63 |
</xsl:for-each> |
|
64 |
<!-- creating title page with metadata --> |
|
65 |
</xsl:template> |
|
66 |
|
|
67 |
|
|
68 |
<!-- first (recursive) pass. look for <pb> elements and group on them --> |
|
69 |
<xsl:template match="comment()|@*|processing-instruction()|text()"> |
|
70 |
<xsl:copy-of select="."/> |
|
71 |
</xsl:template> |
|
72 |
|
|
73 |
<xsl:template match="*"> |
|
74 |
<xsl:call-template name="checkpb"> |
|
75 |
<xsl:with-param name="eName" select="local-name()"/> |
Formats disponibles : Unified diff