Révision 3758

TXM/trunk/bundles/org.txm.core/res/org/txm/css/txm.css (revision 3758)
120 120
  display: none;
121 121
  overflow: hidden;
122 122
}
123

  
124
/* styling of the footnote elements of the default XSL edition*/
125
.footnote {
126
    font-size:85%;
127
    display:block;
128
}
129

  
TXM/trunk/bundles/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl (revision 3758)
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<xsl:stylesheet exclude-result-prefixes="#all"
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
	xmlns:xd="http://www.pnp-software.com/XSLTdoc" version="2.0">
3
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
6
  version="2.0">
7
    
6 8

  
9
  <xd:doc type="stylesheet">
10
    <xd:short>
11
      This stylesheet is designed for TXM XTZ import module to create 
12
      HTML editions of corpus texts. This stylesheet should be used at 
13
      "4-edition" step and must be accompanied by 1-default-html.xsl. 
14
      See TXM User Manual for more details 
15
      (http://textometrie.ens-lyon.fr/spip.php?rubrique64)
16
    </xd:short>
17
    <xd:detail>
18
      This software is dual-licensed:
19
      
20
      1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
21
      Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
22
      
23
      2. http://www.opensource.org/licenses/BSD-2-Clause
24
      
25
      All rights reserved.
26
      
27
      Redistribution and use in source and binary forms, with or without
28
      modification, are permitted provided that the following conditions are
29
      met:
30
      
31
      * Redistributions of source code must retain the above copyright
32
      notice, this list of conditions and the following disclaimer.
33
      
34
      * Redistributions in binary form must reproduce the above copyright
35
      notice, this list of conditions and the following disclaimer in the
36
      documentation and/or other materials provided with the distribution.
37
      
38
      This software is provided by the copyright holders and contributors
39
      "as is" and any express or implied warranties, including, but not
40
      limited to, the implied warranties of merchantability and fitness for
41
      a particular purpose are disclaimed. In no event shall the copyright
42
      holder or contributors be liable for any direct, indirect, incidental,
43
      special, exemplary, or consequential damages (including, but not
44
      limited to, procurement of substitute goods or services; loss of use,
45
      data, or profits; or business interruption) however caused and on any
46
      theory of liability, whether in contract, strict liability, or tort
47
      (including negligence or otherwise) arising in any way out of the use
48
      of this software, even if advised of the possibility of such damage.
49
      
50
      $Id$
51
      
52
      This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
53
      available at 
54
      https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl 
55
      
56
      and is adapted by Alexei Lavrentiev to split an HTML edition for 
57
      TXM platform.
58
    </xd:detail>
59
    <xd:author>Sebastian Rahtz and Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
60
    <xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
61
  </xd:doc>
7 62

  
8
	<xd:doc type="stylesheet">
9
		<xd:short>
10
			This stylesheet is designed for TXM XTZ import module to create
11
			HTML editions of corpus texts. This stylesheet should be used at
12
			"4-edition" step and must be accompanied by 1-default-html.xsl.
13
			See TXM User Manual for more details
14
			(http://textometrie.ens-lyon.fr/spip.php?rubrique64)
15
		</xd:short>
16
		<xd:detail>
17
			This software is dual-licensed:
63
  <!--
18 64

  
19
			1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
20
			Unported License http://creativecommons.org/licenses/by-sa/3.0/
21

  
22
			2. http://www.opensource.org/licenses/BSD-2-Clause
23

  
24
			All rights reserved.
25

  
26
			Redistribution and use in source and binary forms, with or without
27
			modification, are permitted provided that the following conditions are
28
			met:
29

  
30
			* Redistributions of source code must retain the above copyright
31
			notice, this list of conditions and the following disclaimer.
32

  
33
			* Redistributions in binary form must reproduce the above copyright
34
			notice, this list of conditions and the following disclaimer in the
35
			documentation and/or other materials provided with the distribution.
36

  
37
			This software is provided by the copyright holders and contributors
38
			"as is" and any express or implied warranties, including, but not
39
			limited to, the implied warranties of merchantability and fitness for
40
			a particular purpose are disclaimed. In no event shall the copyright
41
			holder or contributors be liable for any direct, indirect,
42
			incidental,
43
			special, exemplary, or consequential damages (including, but not
44
			limited to, procurement of substitute goods or services; loss of use,
45
			data, or profits; or business interruption) however caused and on any
46
			theory of liability, whether in contract, strict liability, or tort
47
			(including negligence or otherwise) arising in any way out of the use
48
			of this software, even if advised of the possibility of such damage.
49

  
50
			$Id$
51

  
52
			This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz
53
			available at
54
			https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl
55

  
56
			and is adapted by Alexei Lavrentiev to split an HTML edition for
57
			TXM platform.
58
		</xd:detail>
59
		<xd:author>Sebastian Rahtz and Alexei Lavrentiev
60
			alexei.lavrentev@ens-lyon.fr</xd:author>
61
		<xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
62
	</xd:doc>
63

  
64
	<!-- -->
65
	<xsl:output indent="no" method="html" />
66

  
67
	<xsl:param name="css-name-txm">
68
		txm
69
	</xsl:param>
70
	<xsl:param name="css-name">
71
		<xsl:value-of select="$current-corpus-name" />
72
	</xsl:param>
73
	<xsl:param name="edition-name">
74
		default
75
	</xsl:param>
76
	<xsl:param name="number-words-per-page">
77
		999999
78
	</xsl:param>
79
	<xsl:param name="pagination-element">
80
		a[@class='txm-page']
81
	</xsl:param>
82
	<xsl:param name="output-directory">
83
		<xsl:value-of
84
			select="concat($current-file-directory,'/',$edition-name)" />
85
	</xsl:param>
86

  
87
	<xsl:variable name="current-file-name">
88
		<xsl:analyze-string select="document-uri(.)"
89
			regex="^(.*)/([^/]+)\.[^/]+$">
90
			<xsl:matching-substring>
91
				<xsl:value-of select="regex-group(2)" />
92
			</xsl:matching-substring>
93
		</xsl:analyze-string>
94
	</xsl:variable>
95

  
96
	<xsl:variable name="current-file-directory">
97
		<xsl:analyze-string select="document-uri(.)"
98
			regex="^(.*)/([^/]+)\.[^/]+$">
99
			<xsl:matching-substring>
100
				<xsl:value-of select="regex-group(1)" />
101
			</xsl:matching-substring>
102
		</xsl:analyze-string>
103
	</xsl:variable>
104

  
105
	<xsl:variable name="current-corpus-name">
106
		<xsl:analyze-string
107
			select="$current-file-directory" regex="^(.*)/([^/]+)/[^/]+$">
108
			<xsl:matching-substring>
109
				<xsl:value-of select="regex-group(2)" />
110
			</xsl:matching-substring>
111
		</xsl:analyze-string>
112
	</xsl:variable>
113

  
114

  
115
	<xsl:template match="html/body">
116
		<xsl:variable name="pages">
117
			<xsl:copy>
118
				<xsl:apply-templates select="@*" />
119
				<xsl:apply-templates
120
					select="*|processing-instruction()|comment()|text()" />
121
			</xsl:copy>
122
		</xsl:variable>
123
		<xsl:for-each select="$pages">
124
			<xsl:apply-templates mode="pass2" />
125
		</xsl:for-each>
126
		<!-- creating title page with metadata -->
127
	</xsl:template>
128

  
129

  
130
	<!-- first (recursive) pass. look for <pb> elements and group on them -->
131
	<xsl:template
132
		match="comment()|@*|processing-instruction()|text()">
133
		<xsl:copy-of select="." />
134
	</xsl:template>
135

  
136
	<xsl:template match="*">
137
		<xsl:call-template name="checkpb">
138
			<xsl:with-param name="eName" select="local-name()" />
139
		</xsl:call-template>
140
	</xsl:template>
141

  
142
	<xsl:template match="a[@class='txm-page']">
143

  
144
		<!-- <xsl:variable name="next-word-position" as="xs:integer"> <xsl:choose> 
145
			<xsl:when test="following::span[@class='w']"> <xsl:value-of select="count(following::span[@class='w'][1]/preceding::span[@class='w'])"/> 
146
			</xsl:when> <xsl:otherwise>20</xsl:otherwise> </xsl:choose> </xsl:variable> 
147
			<xsl:variable name="next-pb-position" as="xs:integer"> <xsl:choose> <xsl:when 
148
			test="following::a[@class='txm-page']"> <xsl:value-of select="count(following::a[@class='txm-page'][1]/preceding::span[@class='w'])"/> 
149
			</xsl:when> <xsl:otherwise>999999999</xsl:otherwise> </xsl:choose> </xsl:variable> 
150
			<!-\-<xsl:value-of select="count(following::a[@class='txm-page'][1]/preceding::a[@class='w'])"/>-\-> 
151
			<xsl:variable name="next-word-id"> <xsl:choose> <xsl:when test="$next-pb-position 
152
			- $next-word-position = 999999999"><!-\-w_0-\-><xsl:value-of select="concat($next-pb-position,' 
153
			- ',$next-word-position)"/></xsl:when> <xsl:when test="$next-pb-position 
154
			&gt; $next-word-position"><xsl:value-of select="following::*:span[@class='w'][1]/@id"/></xsl:when> 
155
			<xsl:otherwise><!-\- w_0 -\-><xsl:value-of select="concat($next-pb-position,' 
156
			- ',$next-word-position)"/></xsl:otherwise> </xsl:choose> </xsl:variable> -->
157

  
158

  
159
		<!-- <a xmlns="http://www.w3.org/1999/xhtml"> -->
160

  
161
		<a>
162
			<xsl:copy-of select="@*" />
163
			<!--<xsl:attribute name="next-word-id"><xsl:value-of select="$next-word-id"/></xsl:attribute> -->
164
		</a>
165
	</xsl:template>
166

  
167
	<xsl:template name="checkpb">
168
		<xsl:param name="eName" />
169
		<xsl:choose>
170
			<xsl:when test="not(.//a[@class='txm-page'])">
171
				<xsl:copy-of select="." />
172
			</xsl:when>
173
			<xsl:otherwise>
174
				<xsl:variable name="pass">
175
					<xsl:call-template name="groupbypb">
176
						<xsl:with-param name="Name" select="$eName" />
177
					</xsl:call-template>
178
				</xsl:variable>
179
				<xsl:for-each select="$pass">
180
					<xsl:apply-templates />
181
				</xsl:for-each>
182
			</xsl:otherwise>
183
		</xsl:choose>
184
	</xsl:template>
185

  
186
	<xsl:template name="groupbypb">
187
		<xsl:param name="Name" />
188
		<xsl:for-each-group select="node()"
189
			group-starting-with="a[@class='txm-page']">
190
			<xsl:choose>
191
				<xsl:when test="self::a[@class='txm-page']">
192
					<xsl:copy-of select="." />
193
					<xsl:element name="{$Name}">
194
						<xsl:attribute name="rend">CONTINUED</xsl:attribute>
195
						<xsl:apply-templates
196
							select="current-group() except ." />
197
					</xsl:element>
198
				</xsl:when>
199
				<xsl:otherwise>
200
					<xsl:element name="{$Name}">
201
						<xsl:for-each select="..">
202
							<xsl:copy-of select="@*" />
203
							<xsl:apply-templates select="current-group()" />
204
						</xsl:for-each>
205
					</xsl:element>
206
				</xsl:otherwise>
207
			</xsl:choose>
208
		</xsl:for-each-group>
209
	</xsl:template>
210

  
211
	<!-- second pass. group by <pb> (now all at top level) and wrap groups in 
212
		<page> -->
213
	<xsl:template match="*" mode="pass2">
214
		<xsl:copy>
215
			<xsl:apply-templates
216
				select="@*|*|processing-instruction()|comment()|text()" mode="pass2" />
217
		</xsl:copy>
218
	</xsl:template>
219

  
220
	<xsl:template
221
		match="comment()|@*|processing-instruction()|text()" mode="pass2">
222
		<xsl:copy-of select="." />
223
	</xsl:template>
224

  
225

  
226

  
227
	<!-- <xsl:variable name="style"> <xsl:copy-of select="/html/head[1]/style[1]"></xsl:copy-of> 
228
		</xsl:variable> -->
229

  
230
	<xsl:template match="*[a[@class='txm-page']]" mode="pass2">
231

  
232
		<xsl:copy>
233
			<xsl:apply-templates select="@*" />
234
			<xsl:for-each-group select="*"
235
				group-starting-with="a[@class='txm-page']">
236
				<xsl:choose>
237
					<xsl:when test="self::a[@class='txm-page']">
238
						<xsl:comment>
239
							Page
240
							<xsl:value-of select="@title" />
241
							déplacée vers
242
							<xsl:value-of
243
								select="concat($output-directory,'/',$current-file-name,'_',@title,'.html')" />
244
						</xsl:comment>
245
						<xsl:result-document
246
							href="{$output-directory}/{$current-file-name}_{@title}.html/">
247
							<html>
248
								<head>
249
									<meta name="txm:first-word-id" content="{@next-word-id}" />
250
									<title>
251
										<xsl:value-of
252
											select="concat($current-file-name,', Page ',@title)" />
253
									</title>
254
									<meta http-equiv="Content-Type"
255
										content="text/html;charset=UTF-8" />
256
									<link rel="stylesheet" media="all" type="text/css"
257
										href="css/{$css-name-txm}.css" />
258
									<xsl:if test="matches($css-name,'\S')">
259
										<link rel="stylesheet" media="all" type="text/css"
260
											href="css/{$css-name}.css" />
261
									</xsl:if>
262
									<!--<xsl:copy-of select="$style"/> -->
263
								</head>
264
								<body>
265
									<div class="txmeditionpage">
266
										<xsl:copy-of select="current-group() except ." />
267
									</div>
268
								</body>
269
							</html>
270
						</xsl:result-document>
271

  
272
					</xsl:when>
273
					<xsl:otherwise>
274
						<xsl:copy-of select="current-group()" />
275
					</xsl:otherwise>
276
				</xsl:choose>
277
			</xsl:for-each-group>
278
		</xsl:copy>
279
	</xsl:template>
280

  
65
  -->
66
  <xsl:output indent="no" method="html"/>
67
  
68
  <xsl:param name="css-name-txm">txm</xsl:param>
69
  <!--<xsl:param name="css-name"><xsl:value-of select="$current-corpus-name"/></xsl:param>-->
70
  <xsl:param name="css-name">teixdico-txm</xsl:param>
71
  <xsl:param name="edition-name">default</xsl:param>
72
  <xsl:param name="number-words-per-page">999999</xsl:param>
73
  <xsl:param name="pagination-element">a[@class='txm-page']</xsl:param>
74
  <xsl:param name="output-directory"><xsl:value-of select="concat($current-file-directory,'/',$edition-name)"/></xsl:param>
75
  
76
  <xsl:variable name="current-file-name">
77
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
78
      <xsl:matching-substring>
79
        <xsl:value-of select="regex-group(2)"/>
80
      </xsl:matching-substring>
81
    </xsl:analyze-string>
82
  </xsl:variable>
83
  
84
  <xsl:variable name="current-file-directory">
85
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$">
86
      <xsl:matching-substring>
87
        <xsl:value-of select="regex-group(1)"/>
88
      </xsl:matching-substring>
89
    </xsl:analyze-string>
90
  </xsl:variable>
91
  
92
  <xsl:variable name="current-corpus-name">
93
    <xsl:analyze-string select="$current-file-directory" regex="^(.*)/([^/]+)/[^/]+$">
94
      <xsl:matching-substring>
95
        <xsl:value-of select="regex-group(2)"/>
96
      </xsl:matching-substring>
97
    </xsl:analyze-string>
98
  </xsl:variable>
99
  
100
  <!-- The 1st pagination pass has been moved to 1-default-html.xsl -->
101
  
102
  <xsl:template match="/">
103
    <xsl:copy>
104
      <xsl:apply-templates mode="pass2"/>
105
    </xsl:copy>
106
  </xsl:template>
107
  
108
    
109
  <!-- second pass. group by <pb> (now all at top level) and generate a separate file for
110
  each page -->
111
  
112
  <xsl:template match="*" mode="pass2">
113
    <xsl:copy>
114
      <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()" mode="pass2"/>
115
    </xsl:copy>
116
  </xsl:template>
117
  
118
  <xsl:template match="comment()|@*|processing-instruction()|text()" mode="pass2">
119
    <xsl:copy-of select="."/>
120
  </xsl:template>
121
  
122
  
123
  
124
  <!--	<xsl:variable name="style">
125
	  <xsl:copy-of select="/html/head[1]/style[1]"></xsl:copy-of>
126
	</xsl:variable>-->
127
  
128
  <xsl:template match="*[a[@class='txm-page']]" mode="pass2" >    
129
    
130
    <xsl:copy>
131
      <xsl:apply-templates select="@*"/>
132
      <xsl:for-each-group select="*" group-starting-with="a[@class='txm-page']">
133
        <xsl:choose>
134
          <xsl:when test="self::a[@class='txm-page']">
135
            <xsl:comment> Page <xsl:value-of select="@title"/> déplacée vers <xsl:value-of select="concat($output-directory,'/',$current-file-name,'_',@title,'.html')"/></xsl:comment>
136
            <xsl:result-document href="{$output-directory}/{$current-file-name}_{@title}.html/">
137
              <html>
138
                <head>
139
                  <meta name="txm:first-word-id" content="{@next-word-id}"/>
140
                  <title><xsl:value-of select="concat($current-file-name,', Page ',@title)"/></title>
141
                  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
142
                  <link rel="stylesheet" media="all" type="text/css" href="css/{$css-name-txm}.css"/>
143
                  <xsl:if test="matches($css-name,'\S')"><link rel="stylesheet" media="all" type="text/css" href="css/{$css-name}.css"/></xsl:if>
144
                  <!--<xsl:copy-of select="$style"/>-->
145
                </head>
146
                <body>
147
                  <div class="{$css-name}">
148
                    <div class="txmeditionpage">
149
                      <xsl:copy-of select="current-group() except ."/>
150
                    </div>
151
                  </div>
152
                </body>
153
              </html>
154
            </xsl:result-document>
155
            
156
          </xsl:when>
157
          <xsl:otherwise>
158
            <xsl:copy-of select="current-group()"/>
159
          </xsl:otherwise>
160
        </xsl:choose>
161
      </xsl:for-each-group>
162
    </xsl:copy>
163
  </xsl:template>
164
  
281 165
</xsl:stylesheet>
TXM/trunk/bundles/org.txm.core/res/org/txm/xml/xsl/1-default-html.xsl (revision 3758)
1 1
<?xml version="1.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"
2
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
3
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
4
	xmlns:tei="http://www.tei-c.org/ns/1.0" 
6 5
	xmlns:txm="http://textometrie.org/1.0"
7 6
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
8 7
	xmlns:xd="http://www.pnp-software.com/XSLTdoc"
9
	exclude-result-prefixes="#all" version="2.0">
10

  
8
                exclude-result-prefixes="#all" version="2.0">
9
                
11 10
	<xd:doc type="stylesheet">
12 11
		<xd:short>
13
			This stylesheet is designed for TXM XTZ import module to
14
			create
15
			HTML editions of corpus texts. This stylesheet should be used at
16
			"4-edition" step and must be accompanied by 2-default-pager.xsl.
17
			See TXM User Manual for more details
12
			This stylesheet is designed for TXM XTZ import module to create 
13
			HTML editions of corpus texts. This stylesheet should be used at 
14
			"4-edition" step and must be accompanied by 2-default-pager.xsl. 
15
			See TXM User Manual for more details 
18 16
			(http://textometrie.ens-lyon.fr/spip.php?rubrique64)
19 17
		</xd:short>
20 18
		<xd:detail>
21
			This stylesheet is free software; you can redistribute it
22
			and/or
19
			This stylesheet is free software; you can redistribute it and/or
23 20
			modify it under the terms of the GNU Lesser General Public
24 21
			License as published by the Free Software Foundation; either
25
			version 3
26
			of the License, or (at your option) any later version.
27

  
22
			version 3 of the License, or (at your option) any later version.
23
			
28 24
			This stylesheet is distributed in the hope that it will be useful,
29
			but
30
			WITHOUT ANY WARRANTY; without even the implied warranty of
31
			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
			but WITHOUT ANY WARRANTY; without even the implied warranty of
26
			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32 27
			Lesser General Public License for more details.
33

  
28
			
34 29
			You should have received a copy of GNU Lesser Public License with
35
			this
36
			stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
30
			this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
37 31
		</xd:detail>
38 32
		<xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
39 33
		<xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
40 34
	</xd:doc>
35
                
36
                
37
                
38
	<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no"/>
39
	
40
	<!-- <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"/> -->
41
	
42
                
43
                <xsl:strip-space elements="*"/>
44
                
45
	<xsl:param name="pagination-element">pb</xsl:param>
46
	
47
	<xsl:variable name="word-element">w</xsl:variable>
48
	
49
	<xsl:variable name="page-number-adjust" as="xs:integer">2</xsl:variable>
50
	
41 51

  
52
<!-- The conditional values below should be used with corpora tokenized at character level-->
42 53

  
43

  
44
	<xsl:output method="xml" encoding="UTF-8"
45
		omit-xml-declaration="no" indent="no" />
46

  
47
	<!-- <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" 
48
		indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> -->
49

  
50

  
51
	<xsl:strip-space elements="*" />
52

  
53
	<xsl:param name="pagination-element">
54
		pb
55
	</xsl:param>
56

  
57
	<xsl:variable name="word-element">
54
	<!--<xsl:variable name="word-element">
58 55
		<xsl:choose>
59
			<xsl:when test="//tei:c//txm:form">
60
				c
61
			</xsl:when>
62
			<xsl:otherwise>
63
				w
64
			</xsl:otherwise>
56
			<xsl:when test="//tei:c//txm:form">c</xsl:when>
57
			<xsl:otherwise>w</xsl:otherwise>
65 58
		</xsl:choose>
66 59
	</xsl:variable>
67 60

  
68 61
	<xsl:variable name="page-number-adjust" as="xs:integer">
69 62
		<xsl:choose>
70
			<xsl:when test="//tei:c//txm:form">
71
				1
72
			</xsl:when>
73
			<xsl:otherwise>
74
				2
75
			</xsl:otherwise>
63
			<xsl:when test="//tei:c//txm:form">1</xsl:when>
64
			<xsl:otherwise>2</xsl:otherwise>
76 65
		</xsl:choose>
77
	</xsl:variable>
66
	</xsl:variable>-->
67
	
68
	
78 69

  
79

  
80
	<xsl:variable name="inputtype">
81
		<xsl:choose>
82
			<xsl:when test="//tei:w//txm:form">
83
				xmltxm
84
			</xsl:when>
85
			<xsl:otherwise>
86
				xmlw
87
			</xsl:otherwise>
88
		</xsl:choose>
89
	</xsl:variable>
90

  
70
                <xsl:variable name="inputtype">
71
                	<xsl:choose>
72
                		<xsl:when test="//tei:w//txm:form">xmltxm</xsl:when>
73
                		<xsl:otherwise>xmlw</xsl:otherwise>
74
                	</xsl:choose>
75
                </xsl:variable>
76
	
91 77
	<xsl:variable name="filename">
92
		<xsl:analyze-string select="document-uri(.)"
93
			regex="^(.*)/([^/]+)\.[^/.]+$">
78
		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/.]+$">
94 79
			<xsl:matching-substring>
95
				<xsl:value-of select="regex-group(2)" />
80
				<xsl:value-of select="regex-group(2)"/>
96 81
			</xsl:matching-substring>
97 82
		</xsl:analyze-string>
98 83
	</xsl:variable>
84
                
85
	<!-- New template for the document node provided for Saxon 11 (1st pagination step moved here) -->
86
                
87
                <!--<xsl:template match="/">
88
                	<html>
89
                		<head>
90
                			<title><xsl:choose>
91
                				<xsl:when test="//tei:text/@id"><xsl:value-of select="//tei:text[1]/@id"/></xsl:when>
92
                				<xsl:otherwise><xsl:value-of select="$filename"/></xsl:otherwise>
93
                			</xsl:choose></title>
94
                			<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
95
                			<link rel="stylesheet" media="all" type="text/css" href="css/txm.css" />
96
                		</head>
97
                			<xsl:apply-templates select="descendant::tei:text"/>
98
                	</html>
99
                </xsl:template>-->
99 100

  
100 101
	<xsl:template match="/">
101
		<html>
102
			<head>
103
				<title>
104
					<xsl:choose>
105
						<xsl:when test="//tei:text/@id">
106
							<xsl:value-of select="//tei:text[1]/@id" />
107
						</xsl:when>
108
						<xsl:otherwise>
109
							<xsl:value-of select="$filename" />
110
						</xsl:otherwise>
111
					</xsl:choose>
112
				</title>
113
				<meta http-equiv="Content-Type"
114
					content="text/html;charset=UTF-8" />
115
				<link rel="stylesheet" media="all" type="text/css"
116
					href="css/txm.css" />
117
			</head>
118
			<xsl:apply-templates
119
				select="descendant::tei:text" />
120
		</html>
102
		<xsl:variable name="pages">
103
			<xsl:apply-templates select="descendant::tei:text"/>
104
		</xsl:variable>
105
		<pages>
106
			<xsl:for-each select="$pages">
107
				<xsl:apply-templates  mode="paginate"/>
108
			</xsl:for-each>
109
		</pages>                	
121 110
	</xsl:template>
111
	
112
	
113
	<!-- Templates for pagination -->
114
	
115
	<!-- first (recursive) pass. look for <pb> elements and group on them -->
116
	
117
	
118
	<xsl:template match="comment()|@*|processing-instruction()|text()" mode="paginate">
119
		<xsl:copy-of select="."/>
120
	</xsl:template>
121
	
122
	<xsl:template match="*" mode="paginate">
123
		<xsl:call-template name="checkpb">
124
			<xsl:with-param name="eName" select="local-name()"/>
125
			<xsl:with-param name="class" select="@class"/>
126
		</xsl:call-template>
127
	</xsl:template>
128
	
129
	<xsl:template match="a[@class='txm-page']" mode="paginate">
130
		
131
		<a>
132
			<xsl:copy-of select="@*"/>
133
			<!--<xsl:attribute name="next-word-id"><xsl:value-of select="$next-word-id"/></xsl:attribute>-->
134
		</a>
135
	</xsl:template>
136
	
137
	<xsl:template name="checkpb">
138
		<xsl:param name="eName"/>
139
		<xsl:param name="class"/>
140
		<xsl:choose>
141
			<xsl:when test="not(.//a[@class='txm-page'])">
142
				<xsl:copy-of select="."/>
143
			</xsl:when>
144
			<xsl:otherwise>
145
				<xsl:variable name="pass">
146
					<xsl:call-template name="groupbypb">
147
						<xsl:with-param name="Name" select="$eName"/>
148
						<xsl:with-param name="class" select="$class"/>
149
					</xsl:call-template>
150
				</xsl:variable>
151
				<xsl:for-each select="$pass">
152
					<xsl:apply-templates mode="#current"/>
153
				</xsl:for-each>
154
			</xsl:otherwise>
155
		</xsl:choose>
156
	</xsl:template>
157
	
158
	<xsl:template name="groupbypb">
159
		<xsl:param name="Name"/>
160
		<xsl:param name="class"/>
161
		<xsl:for-each-group select="node()" group-starting-with="a[@class='txm-page']">
162
			<xsl:choose>
163
				<xsl:when test="self::a[@class='txm-page']">
164
					<xsl:copy-of select="."/>
165
					<xsl:element name="{$Name}">
166
						<xsl:attribute name="rend">CONTINUED</xsl:attribute>
167
						<xsl:attribute name="class" select="$class"/>
168
						<xsl:apply-templates select="current-group() except ." mode="#current"/>
169
					</xsl:element>
170
				</xsl:when>
171
				<xsl:otherwise>
172
					<xsl:element name="{$Name}">
173
						<xsl:for-each select="..">
174
							<xsl:copy-of select="@*"/>
175
							<xsl:apply-templates select="current-group()" mode="#current"/>
176
						</xsl:for-each>
177
					</xsl:element>
178
				</xsl:otherwise>
179
			</xsl:choose>
180
		</xsl:for-each-group>
181
	</xsl:template>
182
	
183
	<!-- second pass. in the default-pager.xsl: 
184
		group by <pb> (now all at top level) and generate separate files for each page -->
185
	
122 186

  
187

  
123 188
	<xsl:template match="tei:text">
124 189
		<body>
125 190
			<xsl:if test="$word-element='w'">
126
				<a class="txm-page" title="1" next-word-id="w_0" />
191
				<a class="txm-page" title="1"  next-word-id="w_0"/>
127 192
				<div class="metadata-page">
128
					<h1>
129
						<xsl:value-of select="@id"></xsl:value-of>
130
					</h1>
131
					<br />
193
					<h1><xsl:value-of select="@id"></xsl:value-of></h1>
194
					<br/>
132 195
					<table>
133 196
						<xsl:for-each select="@*">
134 197
							<tr>
135
								<td>
136
									<xsl:value-of select="name()" />
137
								</td>
138
								<td>
139
									<xsl:value-of select="." />
140
								</td>
198
								<td><xsl:value-of select="name()"/></td>
199
								<td><xsl:value-of select="."/></td>
141 200
							</tr>
142 201
						</xsl:for-each>
143 202
					</table>
144 203
				</div>
145

  
204
				
146 205
			</xsl:if>
147
			<xsl:apply-templates />
148

  
149
			<xsl:variable name="page_id">
150
				<xsl:value-of
151
					select="count(descendant::*[local-name()=$pagination-element])" />
152
			</xsl:variable>
153

  
154
			<xsl:if
155
				test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][count(preceding::*[local-name()=$pagination-element]) = $page_id]">
206
			<xsl:apply-templates/>
207
			
208
			<xsl:variable name="page_id"><xsl:value-of select="count(descendant::*[local-name()=$pagination-element])"/></xsl:variable>
209
			
210
			<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][count(preceding::*[local-name()=$pagination-element]) = $page_id]">
156 211
				<xsl:text>&#xa;</xsl:text>
157
				<br />
158
				<br />
159
				<span
160
					style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">
161
					<xsl:for-each
162
						select="//tei:note[count(preceding::*[local-name()=$pagination-element]) = $page_id]">
163
						<xsl:variable name="note_count">
164
							<xsl:value-of
165
								select="count(preceding::tei:note) + 1" />
166
						</xsl:variable>
167
						<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" 
168
							name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, 
169
							l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> 
170
							<xsl:value-of select="."/></p> -->
171
						<span class="note">
172
							<span style="position:absolute;left:-30px">
173
								<a href="#noteref_{$note_count}" name="note_{$note_count}">
174
									<xsl:value-of select="$note_count" />
175
								</a>
176
								.
177
							</span>
178
							<xsl:apply-templates mode="#current" />
179
						</span>
180
					</xsl:for-each>
181
				</span>
182
				<xsl:text>&#xa;</xsl:text>
183

  
212
				<br/>
213
				<br/>			
214
				<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
215
					<xsl:for-each select="//tei:note[count(preceding::*[local-name()=$pagination-element]) = $page_id]">
216
						<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note) + 1"/></xsl:variable>
217
						<!--<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>-->
218
						<span class="footnote">
219
							<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
220
							<xsl:apply-templates mode="#current"/>
221
						</span>                                                                
222
					</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
223
				
184 224
			</xsl:if>
185

  
186

  
225
			
226
			
187 227
		</body>
188 228
	</xsl:template>
189

  
190

  
191
	<xsl:template match="*">
192
		<xsl:choose>
193
			<xsl:when test="descendant::tei:p|descendant::tei:ab">
194
				<div>
195
					<xsl:call-template name="addClass" />
196
					<xsl:apply-templates />
197
				</div>
198
				<xsl:text>&#xa;</xsl:text>
199
			</xsl:when>
200
			<xsl:otherwise>
201
				<span>
202
					<xsl:call-template name="addClass" />
203
					<xsl:if test="self::tei:add[@del]">
204
						<xsl:attribute name="title"><xsl:value-of
205
							select="@del" /></xsl:attribute>
206
					</xsl:if>
207
					<xsl:apply-templates />
208
				</span>
209
				<xsl:call-template name="spacing" />
210
			</xsl:otherwise>
211
		</xsl:choose>
212
	</xsl:template>
213

  
214
	<xsl:template
215
		match="@*|processing-instruction()|comment()">
216
		<!--<xsl:copy/> -->
217
	</xsl:template>
218

  
219
	<!-- <xsl:template match="comment()"> <xsl:copy/> </xsl:template> -->
220
	<xsl:template match="text()">
221
		<xsl:value-of select="normalize-space(.)" />
222
	</xsl:template>
223

  
224
	<xsl:template name="addClass">
225
		<xsl:attribute name="class">
226
                		<xsl:value-of select="local-name(.)" />
227
                		<xsl:if test="@type"><xsl:value-of
228
			select="concat('-',@type)" /></xsl:if>
229
                		<xsl:if test="@subtype"><xsl:value-of
230
			select="concat('-',@subtype)" /></xsl:if>
231
                		<xsl:if test="@rend"><xsl:value-of
232
			select="concat('-',@rend)" /></xsl:if>
233
                	</xsl:attribute>
234
	</xsl:template>
235

  
236
	<xsl:template match="tei:p|tei:ab|tei:lg">
237
		<p>
238
			<xsl:call-template name="addClass" />
239
			<xsl:apply-templates />
240
		</p>
241
		<xsl:text>&#xa;</xsl:text>
242
	</xsl:template>
243

  
229
	
230
	
231
                <xsl:template match="*">
232
                                <xsl:choose>
233
                                	<xsl:when test="descendant::tei:p|descendant::tei:ab">
234
                                		<div>
235
                                			<xsl:call-template name="addClass"/>
236
                                			<xsl:apply-templates/></div>
237
                                		<xsl:text>&#xa;</xsl:text>
238
                                	</xsl:when>
239
                                	<xsl:otherwise><span>
240
                                		<xsl:call-template name="addClass"/>
241
                                		<xsl:if test="self::tei:add[@del]">
242
                                			<xsl:attribute name="title"><xsl:value-of select="@del"/></xsl:attribute>
243
                                		</xsl:if>
244
                                		<xsl:apply-templates/></span>
245
                                	<xsl:call-template name="spacing"/>
246
                                	</xsl:otherwise>
247
                                </xsl:choose>
248
                </xsl:template>
249
                
250
                <xsl:template match="@*|processing-instruction()|comment()">
251
                                <!--<xsl:copy/>-->
252
                </xsl:template>
253
                
254
<!--                <xsl:template match="comment()">
255
                                <xsl:copy/>
256
                </xsl:template>
257
-->                
258
                <xsl:template match="text()">
259
                                <xsl:value-of select="normalize-space(.)"/>
260
                </xsl:template>
261
                
262
                <xsl:template name="addClass">
263
                	<xsl:attribute name="class">
264
                		<xsl:value-of select="local-name(.)"/>
265
                		<xsl:if test="@type"><xsl:value-of select="concat('-',@type)"/></xsl:if>
266
                		<xsl:if test="@subtype"><xsl:value-of select="concat('-',@subtype)"/></xsl:if>
267
                		<xsl:if test="@rend"><xsl:value-of select="concat('-',@rend)"/></xsl:if>
268
                	</xsl:attribute>                	
269
                </xsl:template>
270
                
271
                <xsl:template match="tei:p|tei:ab|tei:lg">
272
                	<p>
273
                		<xsl:call-template name="addClass"/>
274
                		<xsl:apply-templates/>
275
                	</p>
276
                	<xsl:text>&#xa;</xsl:text>
277
                </xsl:template>
278
	
244 279
	<xsl:template match="tei:head">
245 280
		<h2>
246
			<xsl:call-template name="addClass" />
247
			<xsl:apply-templates />
281
			<xsl:call-template name="addClass"/>
282
			<xsl:apply-templates/>
248 283
		</h2>
249 284
	</xsl:template>
250

  
285
	
251 286
	<xsl:template match="tei:gap">
252 287
		<span class="gap">
253 288
			<xsl:if test="@quantity and @unit">
254
				<xsl:attribute name="title"><xsl:value-of
255
					select="concat(@quantity,' ',@unit)" /></xsl:attribute>
289
				<xsl:attribute name="title"><xsl:value-of select="concat(@quantity,' ',@unit)"/></xsl:attribute>
256 290
			</xsl:if>
257 291
			<xsl:text>[...]</xsl:text>
258 292
		</span>
259
		<xsl:call-template name="spacing" />
293
		<xsl:call-template name="spacing"/>
260 294
	</xsl:template>
261

  
262
	<xsl:template match="//tei:lb">
295
                
296
	<xsl:template match="tei:lb">
263 297
		<xsl:variable name="lbcount">
264 298
			<xsl:choose>
265
				<xsl:when test="ancestor::tei:ab">
266
					<xsl:number from="tei:ab" level="any" />
267
				</xsl:when>
268
				<xsl:when test="ancestor::tei:p">
269
					<xsl:number from="tei:p" level="any" />
270
				</xsl:when>
271
				<xsl:otherwise>
272
					999
273
				</xsl:otherwise>
299
				<xsl:when test="ancestor::tei:ab"><xsl:number from="tei:ab" level="any"/></xsl:when>
300
				<xsl:when test="ancestor::tei:p"><xsl:number from="tei:p" level="any"/></xsl:when>
301
				<xsl:otherwise>999</xsl:otherwise>
274 302
			</xsl:choose>
275 303
		</xsl:variable>
276
		<xsl:if test="@rend='hyphen(-)'">
277
			<span class="hyphen">-</span>
278
		</xsl:if>
279
		<xsl:if test="@rend='hyphen(=)'">
280
			<span class="hyphen">=</span>
281
		</xsl:if>
282
		<xsl:if
283
			test="ancestor::tei:w and not(contains(@rend,'hyphen'))">
284
			<span class="hyphen-added">-</span>
285
		</xsl:if>
286
		<xsl:if
287
			test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]">
288
			<br />
289
			<xsl:text>&#xa;</xsl:text>
290
		</xsl:if>
304
		<xsl:if test="@rend='hyphen(-)'"><span class="hyphen">-</span></xsl:if>
305
		<xsl:if test="@rend='hyphen(=)'"><span class="hyphen">=</span></xsl:if>
306
		<xsl:if test="ancestor::tei:w and not(contains(@rend,'hyphen'))"><span class="hyphen-added">-</span></xsl:if>
307
		<xsl:if test="not($lbcount=1) or preceding-sibling::node()[matches(.,'\S')]"><br/><xsl:text>&#xa;</xsl:text></xsl:if>
291 308
		<xsl:if test="@n and not(@rend='prose')">
292 309
			<xsl:choose>
293 310
				<xsl:when test="matches(@n,'^[0-9]*[05]$')">
294
					<!--<a title="{@n}" class="verseline" style="position:relative"> </a> -->
295
					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of 
296
						select="@n"/></span></span> -->
297
					<span class="verselinenumber">
298
						<xsl:value-of select="@n" />
299
					</span>
300

  
311
					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
312
					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>-->
313
					<span class="verselinenumber"><xsl:value-of select="@n"/></span>
314
					
301 315
				</xsl:when>
302 316
				<xsl:when test="matches(@n,'[^0-9]')">
303
					<!--<a title="{@n}" class="verseline" style="position:relative"> </a> -->
304
					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of 
305
						select="@n"/></span></span> -->
306
					<span class="verselinenumber">
307
						<xsl:value-of select="@n" />
308
					</span>
317
					<!--<a title="{@n}" class="verseline" style="position:relative"> </a>-->
318
					<!--<span class="verseline"><span class="verselinenumber"><xsl:value-of select="@n"/></span></span>-->
319
					<span class="verselinenumber"><xsl:value-of select="@n"/></span>
309 320
				</xsl:when>
310 321
				<xsl:otherwise>
311 322
				</xsl:otherwise>
312 323
			</xsl:choose>
313 324
		</xsl:if>
314 325
	</xsl:template>
315

  
316
	<!-- Page breaks -->
317
	<xsl:template
318
		match="//*[local-name()=$pagination-element]">
319

  
326
	
327
	<!-- Page breaks -->                
328
	<xsl:template match="*[local-name()=$pagination-element]">
329
		
320 330
		<xsl:variable name="next-word-position" as="xs:integer">
321 331
			<xsl:choose>
322 332
				<xsl:when test="following::*[local-name()=$word-element]">
323
					<xsl:value-of
324
						select="count(following::*[local-name()=$word-element][1]/preceding::*[local-name()=$word-element])" />
333
					<xsl:value-of select="count(following::*[local-name()=$word-element][1]/preceding::*[local-name()=$word-element])"/>
325 334
				</xsl:when>
326
				<xsl:otherwise>
327
					0
328
				</xsl:otherwise>
335
				<xsl:otherwise>0</xsl:otherwise>
329 336
			</xsl:choose>
330 337
		</xsl:variable>
331 338
		<xsl:variable name="next-pb-position" as="xs:integer">
332 339
			<xsl:choose>
333
				<xsl:when
334
					test="following::*[local-name()=$pagination-element]">
335
					<xsl:value-of
336
						select="count(following::*[local-name()=$pagination-element][1]/preceding::*[local-name()=$word-element])" />
340
				<xsl:when test="following::*[local-name()=$pagination-element]">
341
					<xsl:value-of select="count(following::*[local-name()=$pagination-element][1]/preceding::*[local-name()=$word-element])"/>
337 342
				</xsl:when>
338
				<xsl:otherwise>
339
					999999999
340
				</xsl:otherwise>
343
				<xsl:otherwise>999999999</xsl:otherwise>
341 344
			</xsl:choose>
342 345
		</xsl:variable>
343 346
		<xsl:variable name="next-word-id">
344 347
			<xsl:choose>
345
				<xsl:when
346
					test="$next-pb-position - $next-word-position = 999999999">
347
					w_0
348
				</xsl:when>
349
				<xsl:when test="$next-pb-position &gt; $next-word-position">
350
					<xsl:value-of
351
						select="following::*[local-name()=$word-element][1]/@id" />
352
				</xsl:when>
353
				<xsl:otherwise>
354
					w_0
355
				</xsl:otherwise>
348
				<xsl:when test="$next-pb-position - $next-word-position = 999999999">w_0</xsl:when>
349
				<xsl:when test="$next-pb-position &gt; $next-word-position"><xsl:value-of select="following::*[local-name()=$word-element][1]/@id"/></xsl:when>
350
				<xsl:otherwise>w_0</xsl:otherwise>
356 351
			</xsl:choose>
357 352
		</xsl:variable>
358

  
359

  
353
		
354
		
360 355
		<xsl:variable name="editionpagetype">
361 356
			<xsl:choose>
362
				<xsl:when test="ancestor::tei:ab">
363
					editionpageverse
364
				</xsl:when>
365
				<xsl:otherwise>
366
					editionpage
367
				</xsl:otherwise>
357
				<xsl:when test="ancestor::tei:ab">editionpageverse</xsl:when>
358
				<xsl:otherwise>editionpage</xsl:otherwise>
368 359
			</xsl:choose>
369 360
		</xsl:variable>
370 361
		<xsl:variable name="pagenumber">
371 362
			<xsl:choose>
372
				<xsl:when test="@n">
373
					<xsl:value-of select="@n" />
374
				</xsl:when>
375
				<xsl:when test="@facs">
376
					<xsl:value-of select="substring-before(@facs,'.')" />
377
				</xsl:when>
378
				<xsl:otherwise>
379
					[NN]
380
				</xsl:otherwise>
363
				<xsl:when test="@n"><xsl:value-of select="@n"/></xsl:when>
364
				<xsl:when test="@facs"><xsl:value-of select="substring-before(@facs,'.')"/></xsl:when>
365
				<xsl:otherwise>[NN]</xsl:otherwise>
381 366
			</xsl:choose>
382 367
		</xsl:variable>
383

  
384
		<xsl:variable name="page_id">
385
			<xsl:value-of
386
				select="count(preceding::*[local-name()=$pagination-element])" />
387
		</xsl:variable>
388

  
389
		<xsl:if
390
			test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
368
		
369
		<xsl:variable name="page_id"><xsl:value-of select="count(preceding::*[local-name()=$pagination-element])"/></xsl:variable>
370
		
371
		<xsl:if test="//tei:note[not(@place='inline') and not(matches(@type,'intern|auto'))][following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
391 372
			<xsl:text>&#xa;</xsl:text>
392
			<br />
393
			<br />
394
			<span
395
				style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">
396
				<xsl:for-each
397
					select="//tei:note[following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
398
					<xsl:variable name="note_count">
399
						<xsl:value-of select="count(preceding::tei:note) + 1" />
400
					</xsl:variable>
401
					<!--<p><xsl:value-of select="$note_count"/>. <a href="#noteref_{$note_count}" 
402
						name="note_{$note_count}">[<xsl:value-of select="preceding::tei:cb[1]/@xml:id"/>, 
403
						l. <xsl:value-of select="preceding::tei:lb[1]/@n"/>]</a><xsl:text> </xsl:text> 
404
						<xsl:value-of select="."/></p> -->
405
					<span class="note">
406
						<span style="position:absolute;left:-30px">
407
							<a href="#noteref_{$note_count}" name="note_{$note_count}">
408
								<xsl:value-of select="$note_count" />
409
							</a>
410
							.
411
						</span>
412
						<xsl:apply-templates mode="#current" />
413
					</span>
414
				</xsl:for-each>
415
			</span>
416
			<xsl:text>&#xa;</xsl:text>
417

  
373
			<br/>
374
			<br/>			
375
			<span style="display:block;border-top-style:solid;border-top-width:1px;border-top-color:gray;padding-top:5px">                                                
376
				<xsl:for-each select="//tei:note[following::*[local-name()=$pagination-element][1][count(preceding::*[local-name()=$pagination-element]) = $page_id]]">
377
					<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note) + 1"/></xsl:variable>
378
					<!--<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>-->
379
					<span class="footnote">
380
						<span class="footnotenumber"><a href="#noteref_{$note_count}" name="note_{$note_count}"><xsl:value-of select="$note_count"/></a>. </span>
381
						<xsl:apply-templates mode="#current"/>
382
						<xsl:text> </xsl:text>
383
					</span>                                                                
384
				</xsl:for-each></span><xsl:text>&#xa;</xsl:text>                                                                
385
			
418 386
		</xsl:if>
419

  
420

  
387
		
388
		
421 389
		<xsl:text>&#xa;</xsl:text>
422
		<br />
423
		<xsl:text>&#xa;</xsl:text>
424

  
425
		<a class="txm-page"
426
			title="{count(preceding::*[local-name()=$pagination-element]) + $page-number-adjust}"
427
			next-word-id="{$next-word-id}" />
428

  
429
		<span class="{$editionpagetype}">
430
			&lt;
431
			<xsl:value-of select="$pagenumber" />
432
			&gt;
433
		</span>
434
		<br />
435
		<xsl:text>&#xa;</xsl:text>
390
		<br/><xsl:text>&#xa;</xsl:text>
391
		
392
			<a class="txm-page" title="{count(preceding::*[local-name()=$pagination-element]) + $page-number-adjust}" next-word-id="{$next-word-id}"/>
393
		
394
		<span class="{$editionpagetype}"> &lt;<xsl:value-of select="$pagenumber"/>&gt; </span><br/><xsl:text>&#xa;</xsl:text>
436 395
	</xsl:template>
437

  
396
	
438 397
	<!-- Notes -->
439 398
	<xsl:template match="tei:note">
440
		<!--<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] 
441
			</span> -->
442
		<xsl:variable name="note_count">
443
			<xsl:value-of select="count(preceding::tei:note) + 1" />
444
		</xsl:variable>
399
		<!--<span style="color:violet"> [<b>Note :</b> <xsl:apply-templates/>] </span>-->	
400
		<xsl:variable name="note_count"><xsl:value-of select="count(preceding::tei:note) + 1"/></xsl:variable>
445 401
		<xsl:variable name="note_content">
446 402
			<xsl:choose>
447 403
				<xsl:when test="descendant::txm:form">
448
					<xsl:for-each select="descendant::txm:form">
449
						<xsl:value-of select="." />
450
						<xsl:if
451
							test="not(matches(following::txm:form[1],'^[.,\)]')) and not(matches(.,'^\S+[''’]$|^[‘\(]$'))">
404
					<xsl:for-each select="descendant::txm:form">						
405
						<xsl:value-of select="."/>
406
						<xsl:if test="not(matches(following::txm:form[1],'^[.,\)]')) and not(matches(.,'^\S+[''’]$|^[‘\(]$'))">
452 407
							<xsl:text> </xsl:text>
453 408
						</xsl:if>
454 409
					</xsl:for-each>
455 410
				</xsl:when>
456
				<xsl:otherwise>
457
					<xsl:value-of select="normalize-space(.)" />
458
				</xsl:otherwise>
411
				<xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise>
459 412
			</xsl:choose>
460 413
		</xsl:variable>
461 414
		<xsl:choose>
462 415
			<xsl:when test="matches(@type,'intern|auto')"></xsl:when>
463
			<xsl:when test="@place='inline'">
464
				<span class="note">
465
					(Note :
466
					<xsl:value-of select="$note_content" />
467
					)
468
				</span>
416
			<xsl:when test="@place='inline'"><span class="note"> (Note : <xsl:value-of select="$note_content"/>)</span></xsl:when>
417
			<xsl:when test="not(@place='inline') and not(matches(@type,'intern|auto'))">
418
				<a title="{$note_content}" style="font-size:75%;position:relative;top:-5px" href="#note_{$note_count}" name="noteref_{$note_count}">[<xsl:value-of select="$note_count"/>]</a>
469 419
			</xsl:when>
470
			<xsl:when
471
				test="not(@place='inline') and not(matches(@type,'intern|auto'))">
472
				<a title="{$note_content}"
473
					style="font-size:75%;position:relative;top:-5px"
474
					href="#note_{$note_count}" name="noteref_{$note_count}">
475
					[
476
					<xsl:value-of select="$note_count" />
477
					]
478
				</a>
479
			</xsl:when>
480
			<xsl:otherwise>
481
				<span class="noteref" title="{$note_content}">[•]</span>
482
			</xsl:otherwise>
420
			<xsl:otherwise><span class="noteref" title="{$note_content}">[•]</span></xsl:otherwise>
483 421
		</xsl:choose>
484
		<xsl:call-template name="spacing" />
422
		<xsl:call-template name="spacing"/>                                
485 423
	</xsl:template>
486

  
424
	
487 425
	<xsl:template match="tei:bibl">
488 426
		<span class="noteref" title="{normalize-space(.)}">[•]</span>
489 427
	</xsl:template>
490

  
428
	
491 429
	<xsl:template match="a[@class='txmpageref']">
492
		<xsl:copy-of select="." />
430
		<xsl:copy-of select="."/>
493 431
	</xsl:template>
494

  
495
	<!--<xsl:template match="tei:note[@place='inline']"> <span class="noteinline"> 
496
		<xsl:apply-templates/> </span> </xsl:template> -->
497
	<xsl:template match="//tei:w">
498
		<span class="w">
499
			<xsl:choose>
500
				<xsl:when test="descendant::tei:c//txm:form">
501
					<xsl:apply-templates select="descendant::tei:c" />
502
				</xsl:when>
503
				<xsl:otherwise>
504
					<xsl:if test="@*:id">
505
						<xsl:attribute name="id"><xsl:value-of
506
							select="@*:id" /></xsl:attribute>
507
					</xsl:if>
508
					<xsl:attribute name="title">
509
                				<xsl:for-each
510
						select="@*[not(matches(local-name(.),'id'))]">
511
                					<xsl:value-of
512
						select="concat(name(.),' : ',.,' ; ')" />
432
	
433
	<!--<xsl:template match="tei:note[@place='inline']">
434
		<span class="noteinline">
435
			<xsl:apply-templates/>
436
		</span>
437
	</xsl:template>
438
   -->             
439
                <xsl:template match="tei:w"><span class="w">
440
                	<xsl:choose>
441
                		<xsl:when test="descendant::tei:c//txm:form">
442
                			<xsl:apply-templates select="descendant::tei:c"/>
443
                		</xsl:when>
444
                		<xsl:otherwise>
445
                			<xsl:if test="@*:id">
446
                				<xsl:attribute name="id"><xsl:value-of select="@*:id"/></xsl:attribute>
447
                			</xsl:if>
448
                			<xsl:attribute name="title">
449
                				<xsl:for-each select="@*[not(matches(local-name(.),'id'))]">
450
                					<xsl:value-of select="concat(name(.),' : ',.,' ; ')"/>
513 451
                				</xsl:for-each>
514 452
                				<xsl:if test="descendant::txm:ana">	
515
                					<xsl:for-each
516
						select="descendant::txm:ana">
517
                						<xsl:value-of
518
						select="concat(substring-after(@type,'#'),' : ',.,' ; ')" />
453
                					<xsl:for-each select="descendant::txm:ana">
454
                						<xsl:value-of select="concat(substring-after(@type,'#'),' : ',.,' ; ')"/>
519 455
                					</xsl:for-each>
520 456
                				</xsl:if>
521 457
                			</xsl:attribute>
522
					<xsl:choose>
523
						<xsl:when test="descendant::txm:form">
524
							<xsl:apply-templates select="txm:form" />
525
						</xsl:when>
526
						<xsl:otherwise>
527
							<xsl:apply-templates />
528
						</xsl:otherwise>
529
					</xsl:choose>
530
				</xsl:otherwise>
531
			</xsl:choose>
532
		</span>
533
		<xsl:call-template name="spacing" />
534
	</xsl:template>
458
                			<xsl:choose>
459
                				<xsl:when test="descendant::txm:form">
460
                					<xsl:apply-templates select="txm:form"/>
461
                				</xsl:when>
462
                				<xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
463
                			</xsl:choose>
464
                		</xsl:otherwise>
465
                	</xsl:choose>
466
                                </span><xsl:call-template name="spacing"/></xsl:template>
467
                
468
<!--                <xsl:template match="//txm:form">
469
                                <xsl:apply-templates/>
470
                </xsl:template>
471
-->                
472
	
535 473

  
536
	<!-- <xsl:template match="//txm:form"> <xsl:apply-templates/> </xsl:template> -->
537

  
538

  
539 474
	<xsl:template name="spacing">
540 475
		<xsl:choose>
541 476
			<xsl:when test="$inputtype='xmltxm'">
542
				<xsl:call-template name="spacing-xmltxm" />
477
				<xsl:call-template name="spacing-xmltxm"/>
543 478
			</xsl:when>
544 479
			<xsl:otherwise>
545
				<xsl:call-template name="spacing-xmlw" />
480
				<xsl:call-template name="spacing-xmlw"/>
546 481
			</xsl:otherwise>
547 482
		</xsl:choose>
548 483
	</xsl:template>
549

  
484
	
550 485
	<xsl:template name="spacing-xmlw">
551 486
		<xsl:choose>
552
			<xsl:when test="ancestor::tei:w" />
553
			<xsl:when
554
				test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]" />
487
			<xsl:when test="ancestor::tei:w"/>
488
			<xsl:when test="following::tei:w[1][matches(.,'^\s*[.,)\]]+\s*$')]"/>			
555 489
			<xsl:when test="matches(.,'^\s*[(\[‘]+$|\w(''|’)\s*$')"></xsl:when>
556
			<xsl:when
557
				test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
490
			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
558 491
			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
559
			<xsl:when
560
				test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]">
492
			<xsl:when test="following::tei:w[1][matches(.,'^\s*[:;!?]+\s*$')]">
561 493
				<xsl:text>&#xa0;</xsl:text>
562 494
			</xsl:when>
563 495
			<xsl:otherwise>
564 496
				<xsl:text> </xsl:text>
565 497
			</xsl:otherwise>
566
		</xsl:choose>
498
		</xsl:choose>                
567 499
	</xsl:template>
568 500

  
569 501
	<xsl:template name="spacing-xmltxm">
570 502
		<xsl:choose>
571
			<xsl:when test="ancestor::tei:w" />
572
			<xsl:when
573
				test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]" />
574
			<xsl:when
575
				test="matches(descendant::txm:form[1],'^[(\[‘]+$|\w(''|’)$')"></xsl:when>
576
			<xsl:when
577
				test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
503
			<xsl:when test="ancestor::tei:w"/>
504
			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[.,)\]]+$')]"/>			
505
			<xsl:when test="matches(descendant::txm:form[1],'^[(\[‘]+$|\w(''|’)$')"></xsl:when>
506
			<xsl:when test="position()=last() and (ancestor::tei:choice or ancestor::tei:supplied[not(@rend='multi_s')])"></xsl:when>
578 507
			<xsl:when test="following-sibling::*[1][self::tei:note]"></xsl:when>
579
			<xsl:when
580
				test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]">
508
			<xsl:when test="following::tei:w[1][matches(descendant::txm:form[1],'^[:;!?]+$')]">
581 509
				<xsl:text>&#xa0;</xsl:text>
582 510
			</xsl:when>
583 511
			<xsl:otherwise>
584 512
				<xsl:text> </xsl:text>
585 513
			</xsl:otherwise>
586
		</xsl:choose>
514
		</xsl:choose>                
587 515
	</xsl:template>
588 516

  
589

  
517
                
590 518
</xsl:stylesheet>

Formats disponibles : Unified diff