html2odt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/xsl/param.xsl ADDED
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
29
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
30
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
31
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
32
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
33
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
34
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
35
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
36
+ xmlns:xlink="http://www.w3.org/1999/xlink"
37
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
38
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
39
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
40
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
41
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
42
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
43
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
44
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
45
+ xmlns:dom="http://www.w3.org/2001/xml-events"
46
+ xmlns:xforms="http://www.w3.org/2002/xforms"
47
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
48
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
49
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
50
+ version="1.0">
51
+
52
+
53
+ <xsl:param name="debug"></xsl:param>
54
+
55
+ <!-- URL of the converted page -->
56
+ <xsl:param name="url">http://localhost</xsl:param>
57
+
58
+ <!-- in the text to convert, heading tags start below this level
59
+ (0 for h1, 1 for h2, etc.) -->
60
+ <xsl:param name="heading_minus_level">0</xsl:param>
61
+
62
+ <!-- default image size -->
63
+ <xsl:param name="img_default_width">8cm</xsl:param>
64
+ <xsl:param name="img_default_height">6cm</xsl:param>
65
+
66
+ <!-- images smaller that this will be placed inline (e.g. smileys) -->
67
+ <xsl:param name="img_inline_threshold">2</xsl:param>
68
+
69
+ </xsl:stylesheet>
70
+
@@ -0,0 +1,93 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:h="http://www.w3.org/1999/xhtml"
29
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
30
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
32
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
33
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
34
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
35
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
36
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
37
+ xmlns:xlink="http://www.w3.org/1999/xlink"
38
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
41
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
42
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
43
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
44
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
46
+ xmlns:dom="http://www.w3.org/2001/xml-events"
47
+ xmlns:xforms="http://www.w3.org/2002/xforms"
48
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
51
+ version="1.0">
52
+
53
+
54
+
55
+ <!-- Text -->
56
+ <xsl:template match="h:div[@id='globalWrapper']//h:div[@class='Standard']">
57
+ <xsl:call-template name="paragraph"/>
58
+ </xsl:template>
59
+ <xsl:template match="h:div[@id='globalWrapper']//h:div[@class='Addsec']">
60
+ <xsl:call-template name="paragraph"/>
61
+ </xsl:template>
62
+ <xsl:template match="h:div[@id='globalWrapper']//h:div[@class='Description']">
63
+ <xsl:call-template name="paragraph"/>
64
+ </xsl:template>
65
+
66
+ <!-- Title and Subtitle -->
67
+ <xsl:template match="h:div[@id='globalWrapper']//h:div[@class='Subject']">
68
+ <text:p text:style-name="Title">
69
+ <xsl:apply-templates mode="inparagraph"/>
70
+ </text:p>
71
+ </xsl:template>
72
+ <xsl:template match="h:div[@id='globalWrapper']//h:div[@class='Subtitle']">
73
+ <text:p text:style-name="Subtitle">
74
+ <xsl:apply-templates mode="inparagraph"/>
75
+ </text:p>
76
+ </xsl:template>
77
+
78
+ <!-- Footnotes -->
79
+ <xsl:template match="h:span[@class='FootOuter']" mode="inparagraph">
80
+ <text:note text:note-class="footnote">
81
+ <xsl:apply-templates mode="inparagraph"/>
82
+ </text:note>
83
+ </xsl:template>
84
+ <xsl:template match="h:span[@class='SupFootMarker']" mode="inparagraph"/>
85
+ <xsl:template match="h:span[@class='HoverFoot']" mode="inparagraph">
86
+ <text:note-body>
87
+ <text:p text:style-name="Footnote">
88
+ <xsl:apply-templates mode="inparagraph"/>
89
+ </text:p>
90
+ </text:note-body>
91
+ </xsl:template>
92
+
93
+ </xsl:stylesheet>
@@ -0,0 +1,94 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:h="http://www.w3.org/1999/xhtml"
29
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
30
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
32
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
33
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
34
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
35
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
36
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
37
+ xmlns:xlink="http://www.w3.org/1999/xlink"
38
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
41
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
42
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
43
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
44
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
46
+ xmlns:dom="http://www.w3.org/2001/xml-events"
47
+ xmlns:xforms="http://www.w3.org/2002/xforms"
48
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
51
+ version="1.0">
52
+
53
+
54
+ <xsl:template match="h:pre[@class]">
55
+ <xsl:choose>
56
+ <xsl:when test="not(child::h:ol)">
57
+ <text:p text:style-name="Preformatted_20_Text">
58
+ <xsl:apply-templates mode="inparagraph"/>
59
+ </text:p>
60
+ </xsl:when>
61
+ <xsl:otherwise>
62
+ <xsl:apply-templates mode="inparagraph"/>
63
+ </xsl:otherwise>
64
+ </xsl:choose>
65
+ <!-- The Preformatted_20_Text style has a margin-bottom of 0, so we add an
66
+ empty line here -->
67
+ <text:p text:style-name="Text_20_body"/>
68
+ </xsl:template>
69
+
70
+ <xsl:template match="h:pre/h:ol" mode="inparagraph">
71
+ <text:list text:style-name="Numbering_20_1">
72
+ <xsl:apply-templates mode="inparagraph"/>
73
+ </text:list>
74
+ </xsl:template>
75
+
76
+ <xsl:template match="h:pre/h:ol/h:li" mode="inparagraph">
77
+ <text:list-item>
78
+ <xsl:apply-templates mode="inparagraph"/>
79
+ </text:list-item>
80
+ </xsl:template>
81
+
82
+ <xsl:template match="h:pre/h:ol/h:li/h:div" mode="inparagraph">
83
+ <text:p text:style-name="Source_20_Code_20_Numbered">
84
+ <xsl:apply-templates mode="inparagraph"/>
85
+ </text:p>
86
+ </xsl:template>
87
+
88
+ <xsl:template match="h:pre/h:ol/h:li/h:div//text()" mode="inparagraph">
89
+ <xsl:call-template name="pre.line.single">
90
+ <xsl:with-param name="content" select="."/>
91
+ </xsl:call-template>
92
+ </xsl:template>
93
+
94
+ </xsl:stylesheet>
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:h="http://www.w3.org/1999/xhtml"
29
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
30
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
32
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
33
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
34
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
35
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
36
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
37
+ xmlns:xlink="http://www.w3.org/1999/xlink"
38
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
41
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
42
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
43
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
44
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
46
+ xmlns:dom="http://www.w3.org/2001/xml-events"
47
+ xmlns:xforms="http://www.w3.org/2002/xforms"
48
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
51
+ version="1.0">
52
+
53
+
54
+
55
+ <!-- Text -->
56
+ <xsl:template match="h:div[@class='standard']">
57
+ <text:p text:style-name="Text_20_body">
58
+ <xsl:apply-templates mode="inparagraph"/>
59
+ </text:p>
60
+ </xsl:template>
61
+
62
+ <xsl:template match="h:div[@class='date']">
63
+ <text:p text:style-name="Subtitle">
64
+ <xsl:apply-templates mode="inparagraph"/>
65
+ </text:p>
66
+ </xsl:template>
67
+
68
+ <!-- Title and Subtitle -->
69
+ <xsl:template match="h:div[@class='subject']">
70
+ <text:p text:style-name="Title">
71
+ <xsl:apply-templates mode="inparagraph"/>
72
+ </text:p>
73
+ </xsl:template>
74
+ <xsl:template match="h:h1[@class='title']">
75
+ <text:p text:style-name="Title">
76
+ <xsl:apply-templates mode="inparagraph"/>
77
+ </text:p>
78
+ </xsl:template>
79
+ <xsl:template match="h:h1[@class='subtitle']">
80
+ <text:p text:style-name="Subtitle">
81
+ <xsl:apply-templates mode="inparagraph"/>
82
+ </text:p>
83
+ </xsl:template>
84
+
85
+ <!-- Footnotes -->
86
+ <xsl:template match="h:div[@class='foot']" mode="inparagraph">
87
+ <text:note text:note-class="footnote">
88
+ <xsl:apply-templates mode="inparagraph"/>
89
+ </text:note>
90
+ </xsl:template>
91
+ <xsl:template match="h:span[@class='foot_label']" mode="inparagraph"/>
92
+ <xsl:template match="h:span[@class='foot_label']"/>
93
+ <xsl:template match="h:div[@class='foot_inner']" mode="inparagraph">
94
+ <text:note-body>
95
+ <text:p text:style-name="Footnote">
96
+ <xsl:apply-templates mode="inparagraph"/>
97
+ </text:p>
98
+ </text:note-body>
99
+ </xsl:template>
100
+
101
+ </xsl:stylesheet>
@@ -0,0 +1,170 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:h="http://www.w3.org/1999/xhtml"
29
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
30
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
32
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
33
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
34
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
35
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
36
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
37
+ xmlns:xlink="http://www.w3.org/1999/xlink"
38
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
41
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
42
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
43
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
44
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
46
+ xmlns:dom="http://www.w3.org/2001/xml-events"
47
+ xmlns:xforms="http://www.w3.org/2002/xforms"
48
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
51
+ version="1.0">
52
+
53
+
54
+ <xsl:template match="h:div[@class='code']/h:pre">
55
+ <text:p text:style-name="Source_20_Code">
56
+ <xsl:apply-templates mode="inparagraph"/>
57
+ </text:p>
58
+ <!-- The Preformatted_20_Text style has a margin-bottom of 0, so we add an
59
+ empty line here -->
60
+ <text:p text:style-name="Text_20_body"/>
61
+ </xsl:template>
62
+
63
+ <!--
64
+ Code highlighting
65
+ This is incomplete, see http://pygments.org/docs/tokens/
66
+ -->
67
+
68
+ <xsl:template match="h:div[@class='code']/h:pre/h:span[@class]" mode="inparagraph">
69
+ <xsl:choose>
70
+ <!-- Keyword and Keyword.* -->
71
+ <xsl:when test="substring(@class,1,1) = 'k'">
72
+ <text:span text:style-name="strong">
73
+ <xsl:apply-templates mode="inparagraph"/>
74
+ </text:span>
75
+ </xsl:when>
76
+ <!-- Name.Class -->
77
+ <xsl:when test="@class = 'nc'">
78
+ <text:span text:style-name="syntax-highlight.class">
79
+ <xsl:apply-templates mode="inparagraph"/>
80
+ </text:span>
81
+ </xsl:when>
82
+ <!-- Name.Function -->
83
+ <xsl:when test="@class = 'nf'">
84
+ <text:span text:style-name="syntax-highlight.function">
85
+ <xsl:apply-templates mode="inparagraph"/>
86
+ </text:span>
87
+ </xsl:when>
88
+ <!-- Name.Tag -->
89
+ <xsl:when test="@class = 'nt'">
90
+ <text:span text:style-name="syntax-highlight.tag">
91
+ <xsl:apply-templates mode="inparagraph"/>
92
+ </text:span>
93
+ </xsl:when>
94
+ <!-- Name.Attribute -->
95
+ <xsl:when test="@class = 'na'">
96
+ <text:span text:style-name="syntax-highlight.attr">
97
+ <xsl:apply-templates mode="inparagraph"/>
98
+ </text:span>
99
+ </xsl:when>
100
+ <!-- Name.Builtin -->
101
+ <xsl:when test="@class = 'nb'">
102
+ <text:span text:style-name="syntax-highlight.builtin">
103
+ <xsl:apply-templates mode="inparagraph"/>
104
+ </text:span>
105
+ </xsl:when>
106
+ <!-- Name.Namespace -->
107
+ <xsl:when test="@class = 'nn'">
108
+ <text:span text:style-name="syntax-highlight.namespace">
109
+ <xsl:apply-templates mode="inparagraph"/>
110
+ </text:span>
111
+ </xsl:when>
112
+ <!-- Name.Exception -->
113
+ <xsl:when test="@class = 'ne'">
114
+ <text:span text:style-name="syntax-highlight.exception">
115
+ <xsl:apply-templates mode="inparagraph"/>
116
+ </text:span>
117
+ </xsl:when>
118
+ <!-- Name.Variable -->
119
+ <xsl:when test="@class = 'nv'">
120
+ <text:span text:style-name="syntax-highlight.var">
121
+ <xsl:apply-templates mode="inparagraph"/>
122
+ </text:span>
123
+ </xsl:when>
124
+ <!-- Name.Builtin.Pseudo -->
125
+ <xsl:when test="@class = 'bp'">
126
+ <text:span text:style-name="syntax-highlight.builtin.pseudo">
127
+ <xsl:apply-templates mode="inparagraph"/>
128
+ </text:span>
129
+ </xsl:when>
130
+ <!-- String and String.* -->
131
+ <xsl:when test="substring(@class,1,1) = 's'">
132
+ <text:span text:style-name="syntax-highlight.string">
133
+ <xsl:apply-templates mode="inparagraph"/>
134
+ </text:span>
135
+ </xsl:when>
136
+ <!-- Number and Number.* -->
137
+ <xsl:when test="substring(@class,1,1) = 'm'">
138
+ <text:span text:style-name="syntax-highlight.number">
139
+ <xsl:apply-templates mode="inparagraph"/>
140
+ </text:span>
141
+ </xsl:when>
142
+ <!-- Operator and Operator.Word -->
143
+ <xsl:when test="substring(@class,1,1) = 'o'">
144
+ <text:span text:style-name="strong">
145
+ <xsl:apply-templates mode="inparagraph"/>
146
+ </text:span>
147
+ </xsl:when>
148
+ <!-- Punctuation -->
149
+ <xsl:when test="@class = 'p'">
150
+ <xsl:apply-templates mode="inparagraph"/>
151
+ </xsl:when>
152
+ <!-- Comment and Comment.* -->
153
+ <xsl:when test="substring(@class,1,1) = 'c'">
154
+ <text:span text:style-name="syntax-highlight.comment">
155
+ <xsl:apply-templates mode="inparagraph"/>
156
+ </text:span>
157
+ </xsl:when>
158
+ <!-- Generic.Error -->
159
+ <xsl:when test="@class = 'err'">
160
+ <text:span text:style-name="syntax-highlight.error">
161
+ <xsl:apply-templates mode="inparagraph"/>
162
+ </text:span>
163
+ </xsl:when>
164
+ <xsl:otherwise>
165
+ <xsl:apply-templates mode="inparagraph"/>
166
+ </xsl:otherwise>
167
+ </xsl:choose>
168
+ </xsl:template>
169
+
170
+ </xsl:stylesheet>
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:h="http://www.w3.org/1999/xhtml"
29
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
30
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
32
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
33
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
34
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
35
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
36
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
37
+ xmlns:xlink="http://www.w3.org/1999/xlink"
38
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
39
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
40
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
41
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
42
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
43
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
44
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
45
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
46
+ xmlns:dom="http://www.w3.org/2001/xml-events"
47
+ xmlns:xforms="http://www.w3.org/2002/xforms"
48
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
49
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
51
+ version="1.0">
52
+
53
+
54
+ <xsl:template match="h:span[@class='underline']"/>
55
+ <xsl:template match="h:span[@class='underline']" mode="inparagraph">
56
+ <text:span text:style-name="underline">
57
+ <xsl:apply-templates mode="inparagraph"/>
58
+ </text:span>
59
+ </xsl:template>
60
+
61
+ </xsl:stylesheet>
data/xsl/specific.xsl ADDED
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+
4
+ xhtml2odt - XHTML to ODT XML transformation.
5
+ Copyright (C) 2009 Aurelien Bompard
6
+ Inspired by the work on docbook2odt, by Roman Fordinal
7
+ http://open.comsultia.com/docbook2odf/
8
+
9
+ License: LGPL v2.1 or later <http://www.gnu.org/licenses/lgpl-2.1.html>
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24
+ MA 02110-1301 USA
25
+
26
+ -->
27
+ <xsl:stylesheet
28
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
29
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
30
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
31
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
32
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
33
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
34
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
35
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
36
+ xmlns:xlink="http://www.w3.org/1999/xlink"
37
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
38
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
39
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
40
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
41
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
42
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
43
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
44
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
45
+ xmlns:dom="http://www.w3.org/2001/xml-events"
46
+ xmlns:xforms="http://www.w3.org/2002/xforms"
47
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
48
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
49
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
50
+ version="1.0">
51
+
52
+ <xsl:include href="specific/trac.xsl"/>
53
+ <xsl:include href="specific/pygments.xsl"/>
54
+ <xsl:include href="specific/geshi.xsl"/>
55
+ <xsl:include href="specific/elyxer.xsl"/>
56
+ <xsl:include href="specific/lyx.xsl"/>
57
+
58
+ </xsl:stylesheet>