Accept attributes in inline image syntax
[multimarkdown] / XSLT / s5.xslt
1 <?xml version='1.0' encoding='utf-8'?>
2
3 <!-- XHTML-to-S5 converted by Fletcher Penney
4         specifically designed for use with MultiMarkdown created XHTML
5         
6         MultiMarkdown Version 2.0.b5
7         
8         $Id: s5.xslt 478 2008-01-12 23:03:47Z fletcher $
9 -->
10
11 <!-- 
12 # Copyright (C) 2005-2008  Fletcher T. Penney <fletcher@fletcherpenney.net>
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the
26 #    Free Software Foundation, Inc.
27 #    59 Temple Place, Suite 330
28 #    Boston, MA 02111-1307 USA
29 -->
30
31 <!-- 
32         TODO: an option to select what h-level should be slides (for instance, if h2, then each h1 would be a slide, containing list of h2's.  Then h2's converted into slides....
33         
34         -->
35         
36 <xsl:stylesheet
37         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
38         xmlns:xhtml="http://www.w3.org/1999/xhtml"
39         xmlns="http://www.w3.org/1999/xhtml"
40         exclude-result-prefixes="xhtml xsl"
41         version="1.0">
42
43         <xsl:output method='xml' encoding='utf-8' indent="yes"/>
44
45         <xsl:strip-space elements="*" />
46
47         <xsl:variable name="theme">default</xsl:variable>
48
49         <xsl:param name="match"/>
50
51         <xsl:template match="/">
52                 <html>
53                 <xsl:apply-templates select="node()"/>
54                 </html>
55         </xsl:template>
56
57         <xsl:template match="xhtml:head">
58                 <head>
59                 <xsl:apply-templates select="xhtml:meta"/>
60                 <xsl:apply-templates select="node()"/>
61                 <meta name="version" content="S5 1.1" />
62                 <meta name="generator" content="MultiMarkdown"/>
63                 <meta name="controlVis" content="hidden"/>
64                 <link rel="stylesheet" href="ui/{$theme}/slides.css" type="text/css" media="projection" id="slideProj" />
65                 <link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
66                 <link rel="stylesheet" href="ui/default/print.css" type="text/css" media="print" id="slidePrint" />
67                 <link rel="stylesheet" href="ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
68                 <script src="ui/default/slides.js" type="text/javascript"></script>
69                 </head>
70         </xsl:template>
71
72         <xsl:template match="xhtml:title">
73                 <title><xsl:value-of select="."/></title>
74         </xsl:template>
75
76         <xsl:template match="xhtml:body">
77                 <body>
78                 <div class="layout">
79                         <div id="controls"><xsl:text>&#x0020;</xsl:text></div>
80                         <div id="currentSlide"><xsl:text>&#x0020;</xsl:text></div>
81                         <div id="header"><xsl:text>&#x0020;</xsl:text></div>
82                         <div id="footer">
83                         <h1><xsl:value-of select="/xhtml:html/xhtml:head/xhtml:title"/></h1>
84                         <h2>
85                                 <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'author']/@content"/>
86                         </h2>
87                         </div>
88                 </div>
89                 <div class="presentation">
90                 <div class="slide">
91                 <h1><xsl:value-of select="/xhtml:html/xhtml:head/xhtml:title"/></h1>
92                 <h2><xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'subtitle']/@content"/></h2>
93                 <h3>
94                 <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'author']/@content"/>
95                 </h3>
96                 <xsl:variable name="url">
97                         <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'url']/@content"/>
98                 </xsl:variable>
99                 <h4><a href="{$url}">
100 <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'organization']/@content"/>
101                 </a></h4>
102                 <h4>
103                         <xsl:value-of select="/xhtml:html/xhtml:head/xhtml:meta[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = 'date']/@content"/>
104                 </h4>                           
105                 </div>
106                 
107                 <xsl:apply-templates select="xhtml:h1"/>
108                 </div>
109                 </body>
110         </xsl:template>
111
112
113         <xsl:template match="xhtml:h1">
114                 <div class="slide">
115                         <h1><xsl:value-of select="."/></h1>     
116                         <xsl:variable name="items" select="count(following-sibling::*) - count(following-sibling::xhtml:h1[1]/following-sibling::*) - count(following-sibling::xhtml:h1[1])"/>
117                         <xsl:apply-templates select="following-sibling::*[position() &lt;= $items]" mode="slide"/>
118                 </div>          
119         </xsl:template>
120
121         <xsl:template match="xhtml:h1[last()]">
122                 <div class="slide">
123                 <h1><xsl:value-of select="."/></h1>
124                 <xsl:variable name="items" select="count(following-sibling::*) - count(following-sibling::h1/following-sibling::*)"/>
125                 <xsl:apply-templates select="following-sibling::*[position() &lt;= $items]" mode="slide"/>
126                 </div>
127         </xsl:template>
128
129         <xsl:template match="xhtml:p" mode="slide">
130                 <xsl:copy-of select="."/>
131         </xsl:template>
132
133         <xsl:template match="xhtml:p[1]" mode="slide">
134                 <xsl:copy-of select="."/>
135         </xsl:template>
136
137         <xsl:template match="xhtml:li" mode="slide">
138                 <li>
139                 <xsl:apply-templates select="node()" mode="slide"/>
140                 </li>
141         </xsl:template>
142
143         <xsl:template match="xhtml:ol" mode="slide">
144 <!--            <ol class="incremental show-first"> -->
145                 <ol>
146                         <xsl:apply-templates select="node()" mode="slide"/>
147                 </ol>
148         </xsl:template>
149
150         <xsl:template match="xhtml:ul" mode="slide">
151                 <ul>
152                         <xsl:apply-templates select="node()" mode="slide"/>
153                 </ul>
154         </xsl:template>
155 </xsl:stylesheet>
156
157