Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / docx / to / placeholders.xsl @ 187

History | View | Annotate | Download (8.7 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
3
                xmlns:cals="http://www.oasis-open.org/specs/tm9901"
4
                xmlns:contypes="http://schemas.openxmlformats.org/package/2006/content-types"
5
                xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
6
                xmlns:dc="http://purl.org/dc/elements/1.1/"
7
                xmlns:dcmitype="http://purl.org/dc/dcmitype/"
8
                xmlns:dcterms="http://purl.org/dc/terms/"
9
                xmlns:html="http://www.w3.org/1999/xhtml"
10
                xmlns:iso="http://www.iso.org/ns/1.0"
11
                xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
12
                xmlns:mml="http://www.w3.org/1998/Math/MathML"
13
                xmlns:o="urn:schemas-microsoft-com:office:office"
14
                xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
15
                xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
16
                xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
17
                xmlns:tei="http://www.tei-c.org/ns/1.0"
18
                xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
19
                xmlns:teix="http://www.tei-c.org/ns/Examples"
20
                xmlns:v="urn:schemas-microsoft-com:vml"
21
                xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
22
                xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
23
                xmlns:w10="urn:schemas-microsoft-com:office:word"
24
                xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
25
                xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
26
                xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
27
                
28
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
29
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
30
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
                version="2.0"
32
                exclude-result-prefixes="cp ve o r m v wp w10 w wne mml tbx iso      tei a xs pic fn xsi dc dcterms dcmitype     contypes teidocx teix html cals">
33
    
34
       <xsl:import href="../../common2/header.xsl"/>
35
       <xsl:import href="../../common2/i18n.xsl"/>
36

    
37
    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
38
      <desc>
39
         <p> TEI stylesheet for making Word docx files from TEI XML </p>
40
         <p>This software is dual-licensed:
41

    
42
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
43
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
44

    
45
2. http://www.opensource.org/licenses/BSD-2-Clause
46
		
47
All rights reserved.
48

    
49
Redistribution and use in source and binary forms, with or without
50
modification, are permitted provided that the following conditions are
51
met:
52

    
53
* Redistributions of source code must retain the above copyright
54
notice, this list of conditions and the following disclaimer.
55

    
56
* Redistributions in binary form must reproduce the above copyright
57
notice, this list of conditions and the following disclaimer in the
58
documentation and/or other materials provided with the distribution.
59

    
60
This software is provided by the copyright holders and contributors
61
"as is" and any express or implied warranties, including, but not
62
limited to, the implied warranties of merchantability and fitness for
63
a particular purpose are disclaimed. In no event shall the copyright
64
holder or contributors be liable for any direct, indirect, incidental,
65
special, exemplary, or consequential damages (including, but not
66
limited to, procurement of substitute goods or services; loss of use,
67
data, or profits; or business interruption) however caused and on any
68
theory of liability, whether in contract, strict liability, or tort
69
(including negligence or otherwise) arising in any way out of the use
70
of this software, even if advised of the possibility of such damage.
71
</p>
72
         <p>Author: See AUTHORS</p>
73
         <p>Id: $Id: placeholders.xsl 9669 2011-11-07 19:17:54Z rahtz $</p>
74
         <p>Copyright: 2008, TEI Consortium</p>
75
      </desc>
76
   </doc>
77

    
78

    
79
    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
80
      <desc>
81
        A callback for any titlepages that belong to the front matter.
82
    </desc>
83
   </doc>
84
    <xsl:template name="titlepages">
85
    </xsl:template>
86
    
87
    
88
    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
89
      <desc>
90
	Title of document        
91
    </desc>
92
   </doc>
93
    <xsl:template name="document-title">
94
        <xsl:choose>
95
            <xsl:when test="/tei:TEI/tei:text/tei:front/tei:titlePage"/>
96
            <xsl:when test="/tei:TEI/tei:text/tei:front/tei:docTitle"/>
97
            <xsl:when
98
		test="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='main']">
99
                <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='main']">
100
                    <xsl:call-template name="block-element">
101
                        <xsl:with-param name="style">GeneratedTitle</xsl:with-param>
102
                    </xsl:call-template>
103
                </xsl:for-each>
104
                <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='sub']">
105
                    <xsl:call-template name="block-element">
106
                        <xsl:with-param name="style">GeneratedSubtitle</xsl:with-param>
107
                    </xsl:call-template>
108
                </xsl:for-each>
109
	    </xsl:when>
110
	    <xsl:otherwise>
111
	      <xsl:for-each select="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title">
112
		<xsl:call-template name="block-element">
113
		  <xsl:with-param name="style">GeneratedTitle</xsl:with-param>
114
		</xsl:call-template>
115
	      </xsl:for-each>
116
	    </xsl:otherwise>  
117
        </xsl:choose>
118
    </xsl:template>
119
    
120
    
121
    <xsl:template name="created-by"/>
122
    <xsl:template name="headerParts"/>
123

    
124
    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
125
      <desc>
126
        
127
        Template for all simple block elements.
128
        This template looks for a style definition template (mode="get-style") that
129
        matches the block element that is currently processed. If none is specified
130
        it copies the style definition from the parent element.
131
        
132
        If some special rendering is required you should overwrite this template.
133
        
134
    </desc>
135
   </doc>
136
    <xsl:template match="*[not(tei:is-inline(.))]" priority="-10">
137
        <xsl:param name="style"/>
138
        <xsl:param name="pPr"/>
139
        <xsl:param name="nop"/>
140
        <!-- calculate style definition -->
141
        <xsl:variable name="newStyle">
142
            <xsl:apply-templates select="." mode="get-style"/>
143
        </xsl:variable>
144
        <xsl:variable name="styleToPassOn">
145
            <xsl:choose>
146
                <xsl:when test="string-length($newStyle) &gt; 0">
147
                    <xsl:value-of select="$newStyle"/>
148
                </xsl:when>
149
                <xsl:otherwise>
150
                    <xsl:value-of select="$style"/>
151
                </xsl:otherwise>
152
            </xsl:choose>
153
        </xsl:variable>
154

    
155
        <!-- process children  -->
156
        <xsl:call-template name="block-element">
157
            <xsl:with-param name="style" select="$styleToPassOn"/>
158
            <xsl:with-param name="pPr" select="$pPr"/>
159
            <xsl:with-param name="nop" select="$nop"/>
160
        </xsl:call-template>
161
    </xsl:template>
162

    
163
    <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
164
      <desc>
165
        
166
            Template for all simple inline elements
167
            This template looks for a character style definition template (mode="get-style")
168
            for the currently processed element.
169
        
170
    </desc>
171
   </doc>
172

    
173
    <xsl:template match="*[tei:is-inline(.)]" priority="-10">
174
        <xsl:param name="character-style"/>
175
        <xsl:param name="style"/>
176
        <xsl:param name="pPr"/>
177
        <xsl:variable name="style">
178
            <xsl:apply-templates select="." mode="get-style"/>
179
        </xsl:variable>
180

    
181
	<xsl:variable name="iso-style">
182
	  <xsl:if test=".//tbx:termNote/@iso:style">
183
	    <xsl:value-of select=".//tbx:termNote/@iso:style"/>
184
	  </xsl:if>
185
	</xsl:variable>
186

    
187
        <xsl:variable name="use-style">
188
            <xsl:choose>
189
                <xsl:when test="(string-length($style) &gt; 0)">
190
                    <xsl:value-of select="$style"/>
191
                </xsl:when>
192
		<xsl:when test="(string-length($iso-style) &gt; 0)">
193
		  <xsl:value-of select="$iso-style"/>
194
		</xsl:when>
195
                <xsl:otherwise>
196
                    <xsl:value-of select="$character-style"/>
197
                </xsl:otherwise>
198
            </xsl:choose>
199
        </xsl:variable>
200

    
201
        <xsl:apply-templates>
202
	  <xsl:with-param name="character-style" select="$use-style"/>
203
        </xsl:apply-templates>
204
    </xsl:template>
205
</xsl:stylesheet>