Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / xhtml2 / corpus.xsl @ 187

History | View | Annotate | Download (7.1 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
3
                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
4
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
5
                xmlns:html="http://www.w3.org/1999/xhtml"
6

    
7
                xmlns:rng="http://relaxng.org/ns/structure/1.0"
8
                xmlns:tei="http://www.tei-c.org/ns/1.0"
9
                xmlns:teix="http://www.tei-c.org/ns/Examples"
10
                
11
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12
                exclude-result-prefixes="a fo rng tei teix"
13
                version="2.0">
14
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
15
      <desc>
16
         <p> TEI stylesheet dealing with elements from the corpus module,
17
      making HTML output. </p>
18
         <p>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
</p>
50
         <p>Author: See AUTHORS</p>
51
         <p>Id: $Id: corpus.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
52
         <p>Copyright: 2011, TEI Consortium</p>
53
      </desc>
54
   </doc>
55
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
56
      <desc>Process element catRef</desc>
57
   </doc>
58
  <xsl:template match="tei:catRef">
59
      <xsl:variable name="W">
60
         <xsl:choose>
61
            <xsl:when test="starts-with(@target,'#')">
62
               <xsl:value-of select="substring(@target,2)"/>
63
            </xsl:when>
64
            <xsl:otherwise>
65
               <xsl:value-of select="@target"/>
66
            </xsl:otherwise>
67
         </xsl:choose>
68
      </xsl:variable>
69
      <xsl:if test="preceding-sibling::tei:catRef">
70
         <xsl:text> 
71
    </xsl:text>
72
      </xsl:if>
73
      <em>
74
         <xsl:value-of select="@scheme"/>
75
      </em>: <xsl:apply-templates select="id($W)/catDesc"/>
76
   </xsl:template>
77
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
78
      <desc>Process element teiCorpus</desc>
79
   </doc>
80
  <xsl:template match="tei:teiCorpus">
81
      <xsl:element name="html" namespace="{$outputNamespace}">
82
         <xsl:call-template name="addLangAtt"/>
83
         <head>
84
            <title>
85
               <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/text()"/>
86
            </title>
87
            <xsl:call-template name="includeCSS"/>
88
            <xsl:call-template name="cssHook"/>
89
         </head>
90
         <body class="simple">
91
	   <xsl:call-template name="bodyMicroData"/>
92
	   <xsl:call-template name="bodyHook"/>
93
	   <xsl:call-template name="bodyJavascriptHook"/>
94
	   <div class="stdheader">
95
	     <xsl:call-template name="stdheader">
96
		<xsl:with-param name="title">
97
		  <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title"/>
98
		</xsl:with-param>
99
	     </xsl:call-template>
100
	    </div>
101
	    <xsl:call-template name="corpusBody"/>
102
            <xsl:call-template name="stdfooter"/>
103
            <xsl:call-template name="bodyEndHook"/>
104
         </body>
105
      </xsl:element>
106
  </xsl:template>
107
  <xsl:template match="tei:teiCorpus" mode="split">
108
      <xsl:variable name="BaseFile">
109
         <xsl:value-of select="$masterFile"/>
110
         <xsl:call-template name="addCorpusID"/>
111
      </xsl:variable>
112
      <xsl:if test="$verbose='true'">
113
         <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
114
      </xsl:if>
115
      <xsl:call-template name="teiStartHook"/>
116
      <xsl:if test="$verbose='true'">
117
         <xsl:message>TEI HTML in corpus splitting mode, base file is <xsl:value-of select="$BaseFile"/>
118
         </xsl:message>
119
      </xsl:if>
120
      <xsl:variable name="outName">
121
         <xsl:call-template name="outputChunkName">
122
	           <xsl:with-param name="ident">
123
	              <xsl:value-of select="$BaseFile"/>
124
	           </xsl:with-param>
125
         </xsl:call-template>
126
      </xsl:variable>
127
    
128
      <xsl:if test="$verbose='true'">
129
         <xsl:message>Opening file <xsl:value-of select="$outName"/>
130
         </xsl:message>
131
      </xsl:if>
132
      <xsl:result-document doctype-public="{$doctypePublic}" 
133
			   doctype-system="{$doctypeSystem}"
134
                           encoding="{$outputEncoding}"
135
                           href="{$outName}"
136
                           method="{$outputMethod}">
137
      
138
         <xsl:element name="html" namespace="{$outputNamespace}">
139
	   <xsl:call-template name="addLangAtt"/>
140
	   <head>
141
	     <title>
142
	       <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/text()"/>
143
	     </title>
144
	     <xsl:call-template name="includeCSS"/>
145
	     <xsl:call-template name="cssHook"/>
146
	   </head>
147
	   <body class="simple">
148
	     <xsl:call-template name="bodyMicroData"/>
149
	     <xsl:call-template name="bodyJavascriptHook"/>
150
	     <xsl:call-template name="bodyHook"/>
151
	     <div class="stdheader">
152
	       <xsl:call-template name="stdheader">
153
		 <xsl:with-param name="title">
154
		   <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[1]"/>
155
		 </xsl:with-param>
156
	       </xsl:call-template>
157
	     </div>
158
	     <xsl:call-template name="corpusBody"/>
159
	     <xsl:call-template name="stdfooter"/>
160
	     <xsl:call-template name="bodyEndHook"/>
161
	   </body>
162
         </xsl:element>
163
      </xsl:result-document>
164
      <xsl:if test="$verbose='true'">
165
         <xsl:message>Closing file <xsl:value-of select="$outName"/>
166
         </xsl:message>
167
      </xsl:if>
168
      <xsl:if test="$verbose='true'">
169
         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
170
      </xsl:if>
171
      <xsl:call-template name="teiEndHook"/>
172
      <xsl:apply-templates select="tei:TEI" mode="split"/>
173
  </xsl:template>
174
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
175
      <desc>[html] </desc>
176
   </doc>
177
  <xsl:template name="corpusBody">
178
    <xsl:call-template name="mainTOC"/>
179
  </xsl:template>
180
</xsl:stylesheet>