forked from MartinPaulEve/meTypeset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordsections.xsl
126 lines (110 loc) · 5.97 KB
/
wordsections.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:prop="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:iso="http://www.iso.org/ns/1.0"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main"
xmlns:mv="urn:schemas-microsoft-com:mac:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:rel="http://schemas.openxmlformats.org/package/2006/relationships"
xmlns:tbx="http://www.lisa.org/TBX-Specification.33.0.html"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns="http://www.tei-c.org/ns/1.0"
version="2.0"
exclude-result-prefixes="a cp dc dcterms dcmitype prop iso m mml mo mv o pic r rel tbx tei teidocx v xs ve w10 w wne wp">
<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
<desc>
<p> TEI stylesheet for converting Word docx files to TEI </p>
<p>This software is dual-licensed:
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
Unported License http://creativecommons.org/licenses/by-sa/3.0/
2. http://www.opensource.org/licenses/BSD-2-Clause
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This software is provided by the copyright holders and contributors
"as is" and any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for
a particular purpose are disclaimed. In no event shall the copyright
holder or contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use,
data, or profits; or business interruption) however caused and on any
theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such damage.
</p>
<p>Author: See AUTHORS</p>
<p>Id: $Id: wordsections.xsl 11233 2012-12-18 19:18:07Z rahtz $</p>
<p>Copyright: 2008, TEI Consortium</p>
<p>Modifications copyright Martin Paul Eve (https://www.martineve.com) 2013</p>
</desc>
</doc>
<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
<desc>
<p>match strange word sections</p>
<p>
See comment at begin of document to understand why this template is calling
a named template. It matches strange Word "sections".
</p>
</desc>
</doc>
<xsl:template match="w:p[w:pPr/w:sectPr]|w:sectPr" mode="paragraph">
<xsl:call-template name="paragraph-sectpr"/>
</xsl:template>
<doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
<desc>
Template called by a match on w:p[w:pPr/w:sectPr]|w:sectPr
</desc>
</doc>
<xsl:template name="paragraph-sectpr">
<xsl:if test="$preserveWordSections='true'">
<xsl:for-each select="descendant-or-self::w:sectPr">
<milestone unit="section">
<xsl:for-each select="w:headerReference">
<tei:header type="{@w:type}" ref="{@r:id}"/>
</xsl:for-each>
<xsl:for-each select="w:footerReference">
<tei:footer type="{@w:type}" ref="{@r:id}"/>
</xsl:for-each>
<xsl:if test="w:pgSz/@w:orient='landscape'">
<tei:orientation type="landscape"/>
</xsl:if>
<xsl:if test="w:pgNumType">
<tei:pageNumbering>
<xsl:if test="w:pgNumType/@w:start">
<xsl:attribute name="start" select="w:pgNumType/@w:start"/>
</xsl:if>
<xsl:if test="w:pgNumType/@w:fmt">
<xsl:attribute name="type" select="w:pgNumType/@w:fmt"/>
</xsl:if>
</tei:pageNumbering>
</xsl:if>
</milestone>
</xsl:for-each>
</xsl:if>
<xsl:next-match/>
</xsl:template>
</xsl:stylesheet>