XML transform templates

This commit is contained in:
David Baer
2015-08-06 09:09:13 -04:00
parent 3c2f50078e
commit 2e01fc257e
13 changed files with 1581 additions and 0 deletions

108
data/bootstrap.xsl Normal file
View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
exclude-result-prefixes="ser"
version="1.0">
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1//EN"
xmlns:html="http://www.w3.org/1999/xhtml"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
cdata-section-elements="html:style"
indent="yes" encoding="utf-8" />
<xsl:variable name="refnum">0</xsl:variable>
<xsl:template match="ser:link" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:br" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<br />
</xsl:template>
<xsl:template match="ser:em" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<em><xsl:apply-templates select="*|text()"/></em>
</xsl:template>
<xsl:template match="ser:strong" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<strong><xsl:apply-templates select="*|text()"/></strong>
</xsl:template>
<xsl:template match="ser:greek" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="greek" xml:lang="grc"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:unicode" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="unicode"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:cite" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="class">ref</xsl:attribute>
<xsl:attribute name="href">#ref<xsl:value-of select="@number"/></xsl:attribute>
<xsl:value-of select="@number"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:ref" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<li class="reference">
<xsl:attribute name="id">ref<xsl:value-of select="@number" /></xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</li>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:choose>
<xsl:when test="@xml:space='preserve'"><pre><xsl:apply-templates select="*|text()"/></pre></xsl:when>
<xsl:otherwise>
<p><xsl:apply-templates select="*|text()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ser:quote" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<blockquote><xsl:apply-templates select="*|text()"/></blockquote>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title><xsl:value-of select="ser:header/ser:title"/></title>
</head>
<body>
<div id="header">
<h1 id="title"><xsl:value-of select="ser:header/ser:title"/></h1>
<h2 id="author"><xsl:value-of select="ser:header/ser:author"/></h2>
<h3 id="occasion"><xsl:value-of select="ser:header/ser:occasion"/></h3>
<h3 id="place"><xsl:value-of select="ser:header/ser:place"/></h3>
<h3 id="date"><xsl:value-of select="ser:header/ser:date"/></h3>
</div>
<div id="body">
<p id="text"><em>Text:</em>&#xa0;<xsl:value-of select="ser:header/ser:text"/></p>
<xsl:apply-templates select="ser:body/*" />
</div>
<xsl:if test="count(ser:footer/ser:ref) &gt; 0">
<div id="footer">
<ol class="references">
<xsl:apply-templates select="ser:footer/ser:ref" />
</ol>
</div>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:transform>

123
data/default.xsl Normal file
View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="us-ascii"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<fo:basic-link color="blue" text-decoration="underline">
<xsl:attribute name="external-destination">url(<xsl:value-of select="@href"/>)</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</fo:basic-link>
</xsl:template>
<xsl:template match="ser:br">
<fo:line-break />
</xsl:template>
<xsl:template match="ser:em">
<fo:inline font-style="italic"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:strong">
<fo:inline font-weight="bold"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:greek">
<fo:inline font-family="PalatinoLinotype"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:hebrew">
<fo:inline font-family="David"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:unicode">
<fo:inline font-family="DejaVuSerif"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:cite">
<fo:inline vertical-align="super" font-size="66%">&#xa0;<fo:basic-link><xsl:attribute name="id">cite-<xsl:value-of select="@number"/></xsl:attribute><xsl:attribute name="internal-destination">ref-<xsl:value-of select="@number"/></xsl:attribute><xsl:value-of select="@number"/></fo:basic-link></fo:inline>
</xsl:template>
<xsl:template match="ser:ref">
<fo:list-item font-size="12pt">
<xsl:attribute name="id">ref-<xsl:value-of select="@number"/></xsl:attribute>
<fo:list-item-label>
<fo:block line-height="150%" font-size="10pt" text-indent="0.125in"><fo:basic-link><xsl:attribute name="internal-destination">cite-<xsl:value-of select="@number"/></xsl:attribute><xsl:value-of select="@number"/>.</fo:basic-link></fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:apply-templates select="*|text()" mode="reference" />
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" mode="body">
<fo:block line-height="150%" text-indent="0.5in"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:p" mode="quote">
<fo:block line-height="125%" font-size="11pt" text-indent="0" space-after="0.125in"><xsl:if test="@xml:space='preserve'"><xsl:attribute name="white-space">pre</xsl:attribute></xsl:if><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:p" mode="reference">
<fo:block line-height="150%" font-size="10pt" margin-left="0.4in" text-indent="-0.125in" margin-bottom="0.125in" text-align="left"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:quote" mode="body">
<fo:block margin-left="0.5in" margin-right="0.5in" space-before="0.125in" space-after="0.125in"><xsl:apply-templates select="*|text()" mode="quote"/></fo:block>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="letter"
page-width="8.5in"
page-height="11in"
margin="0.5in">
<!-- Page template goes here -->
<fo:region-body margin="0.5in" />
<fo:region-after extent="0.5in" margin="0in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="letter" font-family="Palatino Linotype, Times, serif">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="12pt">Page <fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" text-align="justify">
<fo:block text-align="center" font-size="20pt" font-weight="bold" space-after="0.25in"><xsl:value-of select="ser:header/ser:title"/></fo:block>
<fo:block text-align="center" font-size="16pt" space-after="0.25in"><xsl:value-of select="ser:header/ser:author"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:place"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:occasion"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:date"/></fo:block>
<fo:block line-height="150%" space-before="1em" space-after="1em"><fo:inline font-style="italic">Text:</fo:inline>&#xa0;<xsl:value-of select="ser:header/ser:text"/></fo:block>
<xsl:apply-templates select="ser:body/*" mode="body">
</xsl:apply-templates>
<fo:block margin-top="1in">
<xsl:if test="count(ser:footer/ser:ref) > 0">
<fo:leader leader-length="2in" leader-pattern="rule" rule-thickness="0.1mm" rule-style="solid" color="black"/>
<fo:list-block>
<xsl:apply-templates select="ser:footer/ser:ref" />
</fo:list-block>
</xsl:if>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:transform>

153
data/docx.xsl Normal file
View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
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"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<text:a xlink:type="simple" xlink:href=""><xsl:attribute name="xlink:href"><xsl:value-of select="@href"/></xsl:attribute><text:span text:style-name="T2"><xsl:apply-templates match="*|text()"/></text:span></text:a>
</xsl:template>
<xsl:template match="ser:br">
<text:line-break/>
</xsl:template>
<xsl:template match="ser:em">
<text:span text:style-name="T6"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:strong">
<text:span text:style-name="T4"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:greek">
<text:span text:style-name="T7"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:hebrew">
<text:span text:style-name="T3"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:unicode">
<text:span text:style-name="T9"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template name="do-footnote">
<xsl:param name="number"/>
<xsl:apply-templates select="/ser:sermon/ser:footer/ser:ref[@number=$number]/*|/ser:sermon/ser:footer/ser:ref[@number=$number]/text()"/>
</xsl:template>
<xsl:template match="ser:cite">
<text:note text:note-class="footnote"><xsl:attribute name="text:id">ftn<xsl:value-of select="@number"/></xsl:attribute><text:note-citation><xsl:value-of select="@number"/></text:note-citation><text:note-body><text:p text:style-name="Footnote"><xsl:call-template name="do-footnote"><xsl:with-param name="number" select="@number"/></xsl:call-template></text:p></text:note-body></text:note>
</xsl:template>
<xsl:template match="ser:ref">
<!-- empty (handled by ser:cite template) -->
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" mode="body">
<w:p w:rsidR="001D323B" w:rsidRPr="00496608" w:rsidRDefault="001D323B">
<w:pPr>
<w:pStyle w:val="BodyText"/>
</w:pPr>
<w:r w:rsidRPr="00496608">
<w:t><xsl:apply-templates select="*|text()"/></w:t>
</w:r>
</w:p>
</xsl:template>
<xsl:template match="ser:p" mode="quote">
<text:p>
<xsl:choose>
<xsl:when test="not(preceding-sibling::*)">
<xsl:attribute name="text:style-name">P1</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:style-name">Quotations</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*|text()"/>
</text:p>
</xsl:template>
<xsl:template match="ser:quote" mode="body">
<xsl:apply-templates mode="quote" select="*|text()"/>
</xsl:template>
<xsl:template name="header">
<xsl:param name="style"/>
<xsl:param name="content"/>
<w:p w:rsid="001D323B" w:rsidRDefault="001D323B">
<w:pPr>
<w:pStyle w:val="$style"/>
</w:pPr>
<w:r>
<w:t><xsl:value-of select="$content"/></w:t>
</w:r>
</w:p>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<w:document>
<w:body>
<xsl:call-template name="header">
<xsl:with-param name="style">Title</xsl:with-param>
<xsl:with-param name="content"><xsl:value-of select="ser:header/ser:title"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="header">
<xsl:with-param name="style">Author</xsl:with-param>
<xsl:with-param name="content"><xsl:value-of select="ser:header/ser:author"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="header">
<xsl:with-param name="style">LiturgicalOccasion</xsl:with-param>
<xsl:with-param name="content"><xsl:value-of select="ser:header/ser:occasion"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="header">
<xsl:with-param name="style">Date</xsl:with-param>
<xsl:with-param name="content"><xsl:value-of select="ser:header/ser:date"/></xsl:with-param>
</xsl:call-template>
<w:p w:rsidR="001D323B" w:rsidRPr="00496608" w:rsidRDefault="001D323B">
<w:pPr>
<w:pStyle w:val="Text"/>
<w:rPr>
<w:i w:val="0"/>
<w:iCs w:val="0"/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00496608">
<w:t xml:space="preserve">Text: </w:t>
</w:r>
<w:r w:rsidRPr="00496608">
<w:rPr>
<w:i w:val="0"/>
<w:iCs w:val="0"/>
</w:rPr>
<w:t><xsl:value-of select="ser:header/ser:text"/></w:t>
</w:r>
</w:p>
<xsl:apply-templates select="*|text()"/>
<w:sectPr w:rsidR="001D323B" w:rsidRPr="00496608" w:rsidSect="00496608">
<w:footerReference w:type="default" r:id="rId6"/>
<w:footerReference w:type="first" r:id="rId7"/>
<w:pgSz w:w="10080" w:h="12240" w:orient="landscape" w:code="5"/>
<w:pgMar w:top="720" w:right="720" w:bottom="720" w:left="720" w:header="720" w:footer="1440" w:gutter="0"/>
<w:cols w:space="720"/>
</w:sectPr>
</w:body>
</w:document>
</xsl:template>
</xsl:transform>

178
data/html.xsl Normal file
View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
exclude-result-prefixes="ser"
version="1.0">
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1//EN"
xmlns:html="http://www.w3.org/1999/xhtml"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
cdata-section-elements="html:style"
indent="yes" encoding="utf-8" />
<xsl:variable name="refnum">0</xsl:variable>
<xsl:template match="ser:link" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:br" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<br />
</xsl:template>
<xsl:template match="ser:em" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<em><xsl:apply-templates select="*|text()"/></em>
</xsl:template>
<xsl:template match="ser:strong" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<strong><xsl:apply-templates select="*|text()"/></strong>
</xsl:template>
<xsl:template match="ser:greek" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="greek" xml:lang="grc"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:unicode" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="unicode"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:cite" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="class">ref</xsl:attribute>
<xsl:attribute name="href">#ref<xsl:value-of select="@number"/></xsl:attribute>
<xsl:value-of select="@number"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:ref" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<li class="reference">
<xsl:attribute name="id">ref<xsl:value-of select="@number" /></xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</li>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:choose>
<xsl:when test="@xml:space='preserve'"><pre><xsl:apply-templates select="*|text()"/></pre></xsl:when>
<xsl:otherwise>
<p><xsl:apply-templates select="*|text()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ser:quote" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<blockquote><xsl:apply-templates select="*|text()"/></blockquote>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title><xsl:value-of select="ser:header/ser:title"/></title>
<style type="text/css"><![CDATA[
html {
background-color: #46597D;
color: white;
}
body {
font-family: "Palatino Linotype", serif;
font-size: 12pt;
}
#header, #body, #footer {
width: 700px;
background: white;
color: black;
position: relative;
margin: 0 auto;
padding: 6px 2em;
}
#header h1, #header h2, #header h3 {
text-align: center;
}
#header h2 {
font-size: 12pt;
font-weight: normal;
margin: 15px 0 15px 0;
}
#header h3 {
font-weight: normal;
font-style: italic;
font-size: 12pt;
margin-top: 0;
margin-bottom: 0;
}
#body p {
line-height: 150%;
text-indent: 30px;
text-align: justify;
}
#body p#text {
text-indent: 0;
}
a.ref {
vertical-align: super;
font-size: 50%;
}
#body blockquote {
margin-left: 30px;
margin-right: 30px;
background: #ccc;
padding: 6px;
font-size: 11pt;
}
#body blockquote p {
line-height: 100%;
}
#footer li {
font-size: 10pt;
}
]]></style>
</head>
<body>
<div id="header">
<h1 id="title"><xsl:value-of select="ser:header/ser:title"/></h1>
<h2 id="author"><xsl:value-of select="ser:header/ser:author"/></h2>
<h3 id="occasion"><xsl:value-of select="ser:header/ser:occasion"/></h3>
<h3 id="place"><xsl:value-of select="ser:header/ser:place"/></h3>
<h3 id="date"><xsl:value-of select="ser:header/ser:date"/></h3>
</div>
<div id="body">
<p id="text"><em>Text:</em>&#xa0;<xsl:value-of select="ser:header/ser:text"/></p>
<xsl:apply-templates select="ser:body/*" />
</div>
<xsl:if test="count(ser:footer/ser:ref) &gt; 0">
<div id="footer">
<ol class="references">
<xsl:apply-templates select="ser:footer/ser:ref" />
</ol>
</div>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:transform>

195
data/html5.xsl Normal file
View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
exclude-result-prefixes="ser"
version="1.0">
<xsl:output method="xml" doctype-system="about:legacy-compat"
xmlns:html="http://www.w3.org/1999/xhtml"
cdata-section-elements="html:style"
indent="yes" encoding="utf-8"
omit-xml-declaration="yes" />
<xsl:variable name="refnum">0</xsl:variable>
<xsl:template name="css">
<xsl:param name="code"/>
<style type="text/css">
<xsl:text disable-output-escaping="yes">
/* &lt;![CDATA[ */
</xsl:text>
<xsl:value-of select="$code" disable-output-escaping="yes" />
<xsl:text disable-output-escaping="yes">
/* ]]&gt; */
</xsl:text>
</style>
</xsl:template>
<xsl:template match="ser:link" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:br" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<br />
</xsl:template>
<xsl:template match="ser:em" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<em><xsl:apply-templates select="*|text()"/></em>
</xsl:template>
<xsl:template match="ser:strong" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<strong><xsl:apply-templates select="*|text()"/></strong>
</xsl:template>
<xsl:template match="ser:greek" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="greek" xml:lang="grc"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:unicode" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="unicode"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:cite" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="class">ref</xsl:attribute>
<xsl:attribute name="href">#ref<xsl:value-of select="@number"/></xsl:attribute>
<xsl:value-of select="@number"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:ref" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<li class="reference">
<xsl:attribute name="id">ref<xsl:value-of select="@number" /></xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</li>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:choose>
<xsl:when test="@xml:space='preserve'"><pre><xsl:apply-templates select="*|text()"/></pre></xsl:when>
<xsl:otherwise>
<p><xsl:apply-templates select="*|text()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ser:quote" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<blockquote><xsl:apply-templates select="*|text()"/></blockquote>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title><xsl:value-of select="ser:header/ser:title"/></title>
<meta charset="utf-8" />
<xsl:call-template name="css">
<xsl:with-param name="code"><![CDATA[
html {
background-color: #46597D;
color: white;
}
body {
font-family: "Palatino Linotype", serif;
font-size: 12pt;
margin: 0;
}
header, main, footer {
width: 700px;
background: white;
color: black;
position: relative;
margin: 0 auto;
padding: 6px 2em;
}
header h1, header h2, header h3 {
text-align: center;
}
header h2 {
font-size: 12pt;
font-weight: normal;
margin: 15px 0 15px 0;
}
header h3 {
font-weight: normal;
font-style: italic;
font-size: 12pt;
margin-top: 0;
margin-bottom: 0;
}
main p {
line-height: 150%;
text-indent: 30px;
text-align: justify;
}
main p#text {
text-indent: 0;
}
a.ref {
vertical-align: super;
font-size: 50%;
}
main blockquote {
margin-left: 30px;
margin-right: 30px;
background: #ccc;
padding: 6px;
font-size: 11pt;
}
main blockquote p {
line-height: 100%;
}
footer li {
font-size: 10pt;
}
]]></xsl:with-param>
</xsl:call-template>
</head>
<body>
<header>
<h1 id="title"><xsl:value-of select="ser:header/ser:title"/></h1>
<h2 id="author"><xsl:value-of select="ser:header/ser:author"/></h2>
<h3 id="occasion"><xsl:value-of select="ser:header/ser:occasion"/></h3>
<h3 id="place"><xsl:value-of select="ser:header/ser:place"/></h3>
<h3 id="date"><xsl:value-of select="ser:header/ser:date"/></h3>
</header>
<main>
<p id="text"><em>Text:</em>&#xa0;<xsl:value-of select="ser:header/ser:text"/></p>
<xsl:apply-templates select="ser:body/*" />
</main>
<xsl:if test="count(ser:footer/ser:ref) &gt; 0">
<footer>
<ol class="references">
<xsl:apply-templates select="ser:footer/ser:ref" />
</ol>
</footer>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:transform>

82
data/kindle.xsl Normal file
View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="us-ascii"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<fo:inline text-decoration="underline"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:br">
<fo:line-break />
</xsl:template>
<xsl:template match="ser:em">
<fo:inline font-style="italic"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:strong">
<fo:inline font-weight="bold"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:greek">
<fo:inline font-family="PalatinoLinotype"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:hebrew">
<fo:inline font-family="David"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:unicode">
<fo:inline font-family="DejaVuSerif"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:cite"></xsl:template>
<xsl:template match="ser:ref"></xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p">
<fo:block text-indent="0.2in"><xsl:if test="@xml:space='preserve'"><xsl:attribute name="white-space">pre</xsl:attribute></xsl:if><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:quote">
<fo:block border="2px grey solid" font-size="10pt" padding="0.1in" space-before="0.1in" space-after="0.1in" line-height="125%" margin-left="0.1in" margin-right="0.1in"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="kindle"
page-width="3.6in"
page-height="4.8in"
margin="0.3in">
<!-- Page template goes here -->
<fo:region-body margin="0.3in 0.3in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="kindle" font-family="Palatino Linotype, Times, serif">
<!-- fo:static-content flow-name="xsl-region-before" margin-left="0.5in" margin-right="0.5in">
<fo:block text-align="right" font-size="12pt">Page <fo:page-number/></fo:block>
</fo:static-content -->
<fo:flow flow-name="xsl-region-body" line-height="200%" font-size="10pt">
<fo:block text-align="center" font-size="10pt" font-weight="bold" space-after="0.25in"><xsl:value-of select="ser:header/ser:title"/></fo:block>
<xsl:apply-templates select="ser:body/*" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:transform>

67
data/liturgy.xsl Normal file
View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="us-ascii"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lit="urn:david-liturgy"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="lit:em">
<fo:inline font-style="italic"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="lit:strong">
<fo:inline font-weight="bold"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="lit:p">
<fo:block space-after="0.75em" font-size="18pt"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="lit:quote">
<fo:block space-start="0.5in" space-end="0.5in"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="lit:header">
<fo:block space-after="1em" font-weight="bold" font-size="18pt"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="lit:part">
<xsl:apply-templates select="*" />
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/lit:liturgy">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="letter"
page-width="8.5in"
page-height="11in"
margin="0.5in">
<!-- Page template goes here -->
<fo:region-body margin="0.5in" />
<fo:region-after extent="0.5in" margin="0in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="letter" font-family="Arial, sans-serif">
<!-- fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="16pt">Page <fo:page-number/></fo:block>
</fo:static-content -->
<fo:flow flow-name="xsl-region-body" text-align="left">
<xsl:apply-templates select="*">
</xsl:apply-templates>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:transform>

83
data/manuscript.xsl Normal file
View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="us-ascii"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<fo:inline text-decoration="underline"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:br">
<fo:line-break />
</xsl:template>
<xsl:template match="ser:em">
<fo:inline font-style="italic"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:strong">
<fo:inline font-weight="bold"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:greek">
<fo:inline font-family="PalatinoLinotype"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:hebrew">
<fo:inline font-family="David"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:unicode">
<fo:inline font-family="DejaVuSerif"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:cite"></xsl:template>
<xsl:template match="ser:ref"></xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p">
<fo:block text-indent="0.5in"><xsl:if test="@xml:space='preserve'"><xsl:attribute name="white-space">pre</xsl:attribute></xsl:if><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:quote">
<fo:block border="2px grey solid" font-size="12pt" padding="0.1in" space-before="0.25in" space-after="0.25in" line-height="125%" margin-left="0.25in" margin-right="0.25in"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="letter"
page-width="8.5in"
page-height="11in"
margin="0.5in">
<!-- Page template goes here -->
<fo:region-body margin="0.5in 1.0in" />
<fo:region-before extent="0.5in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="letter" font-family="Palatino Linotype, Times, serif">
<fo:static-content flow-name="xsl-region-before" margin-left="0.5in" margin-right="0.5in">
<fo:block text-align="right" font-size="12pt">Page <fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" line-height="200%" font-size="16pt">
<fo:block text-align="center" font-size="16pt" font-weight="bold" space-after="0.25in"><xsl:value-of select="ser:header/ser:title"/></fo:block>
<xsl:apply-templates select="ser:body/*" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:transform>

158
data/ms_odt.xsl Normal file
View File

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rpt="http://openoffice.org/2005/report"
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#"
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<!-- links are not needed in manuscript - simply copy text -->
<xsl:apply-templates match="*|text()"/>
</xsl:template>
<xsl:template match="ser:br">
<text:line-break/>
</xsl:template>
<xsl:template match="ser:em">
<text:span text:style-name="T1"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:strong">
<text:span text:style-name="T3"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:greek">
<xsl:apply-templates select="*|text()"/>
</xsl:template>
<xsl:template match="ser:hebrew">
<text:span text:style-name="Hebrew"><text:span text:style-name="T2"><xsl:apply-templates select="*|text()"/></text:span></text:span>
</xsl:template>
<xsl:template match="ser:unicode">
<xsl:apply-templates select="*|text()"/>
</xsl:template>
<xsl:template match="ser:cite">
<!-- empty: not needed -->
</xsl:template>
<xsl:template match="ser:ref">
<!-- empty (handled by ser:cite template) -->
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" mode="body">
<text:p text:style-name="Text"><xsl:apply-templates select="*|text()"/></text:p>
</xsl:template>
<xsl:template match="ser:p" mode="quote">
<text:p text:style-name="Quotations"><text:span text:style-name="T2"><xsl:apply-templates select="*|text()"/></text:span></text:p>
</xsl:template>
<xsl:template match="ser:quote" mode="body">
<xsl:apply-templates mode="quote" select="*|text()"/>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<office:document-content
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rpt="http://openoffice.org/2005/report"
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:grddl="http://www.w3.org/2003/g/data-view#"
xmlns:tableooo="http://openoffice.org/2009/table"
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
<office:scripts/>
<office:font-face-decls>
<style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>
<style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-adornments="Bold" style:font-pitch="variable"/>
<style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Palatino Linotype" svg:font-family="'Palatino Linotype'" style:font-adornments="Regular" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Bitstream Vera Sans1" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:automatic-styles>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties fo:font-style="normal" style:font-style-asian="normal" style:font-style-complex="normal"/>
</style:style>
<style:style style:name="T3" style:family="text">
<style:text-properties fo:font-style="normal" fo:font-weight="bold" style:font-style-asian="normal" style:font-style-complex="normal"/>
</style:style>
</office:automatic-styles>
<office:body>
<office:text>
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="Title"><xsl:value-of select="ser:header/ser:title"/></text:p>
<xsl:apply-templates select="ser:body/*" mode="body"/>
</office:text>
</office:body>
</office:document-content>
</xsl:template>
</xsl:transform>

171
data/odt.xsl Normal file
View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:ooow="http://openoffice.org/2004/writer"
xmlns:oooc="http://openoffice.org/2004/calc"
xmlns:dom="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rpt="http://openoffice.org/2005/report"
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#"
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:link">
<text:a xlink:type="simple" xlink:href=""><xsl:attribute name="xlink:href"><xsl:value-of select="@href"/></xsl:attribute><text:span text:style-name="T2"><xsl:apply-templates match="*|text()"/></text:span></text:a>
</xsl:template>
<xsl:template match="ser:br">
<text:line-break/>
</xsl:template>
<xsl:template match="ser:em">
<text:span text:style-name="T6"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:strong">
<text:span text:style-name="T4"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:greek">
<text:span text:style-name="T7"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:hebrew">
<text:span text:style-name="T3"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template match="ser:unicode">
<text:span text:style-name="T9"><xsl:apply-templates select="*|text()"/></text:span>
</xsl:template>
<xsl:template name="do-footnote">
<xsl:param name="number"/>
<xsl:apply-templates select="/ser:sermon/ser:footer/ser:ref[@number=$number]/*|/ser:sermon/ser:footer/ser:ref[@number=$number]/text()"/>
</xsl:template>
<xsl:template match="ser:cite">
<text:note text:note-class="footnote"><xsl:attribute name="text:id">ftn<xsl:value-of select="@number"/></xsl:attribute><text:note-citation><xsl:value-of select="@number"/></text:note-citation><text:note-body><text:p text:style-name="Footnote"><xsl:call-template name="do-footnote"><xsl:with-param name="number" select="@number"/></xsl:call-template></text:p></text:note-body></text:note>
</xsl:template>
<xsl:template match="ser:ref">
<!-- empty (handled by ser:cite template) -->
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" mode="body">
<text:p text:style-name="Text_20_body"><xsl:apply-templates select="*|text()"/></text:p>
</xsl:template>
<xsl:template match="ser:p" mode="quote">
<text:p>
<xsl:choose>
<xsl:when test="not(preceding-sibling::*)">
<xsl:attribute name="text:style-name">P1</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="text:style-name">Quotations</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*|text()"/>
</text:p>
</xsl:template>
<xsl:template match="ser:quote" mode="body">
<xsl:apply-templates mode="quote" select="*|text()"/>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<office:document-content office:version="1.2">
<office:scripts/>
<office:font-face-decls>
<style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/>
<style:font-face style:name="Calibri1" svg:font-family="Calibri" style:font-adornments="Bold" style:font-pitch="variable"/>
<style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-adornments="Regular" style:font-pitch="variable"/>
<style:font-face style:name="Code2000" svg:font-family="Code2000" style:font-pitch="variable"/>
<style:font-face style:name="Code2001" svg:font-family="Code2001" style:font-pitch="variable"/>
<style:font-face style:name="David" svg:font-family="David" style:font-pitch="variable"/>
<style:font-face style:name="Bitstream Vera Sans" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Bitstream Vera Sans1" svg:font-family="'Bitstream Vera Sans'" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:automatic-styles>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Quotations">
<style:paragraph-properties fo:margin-top="0.125in" fo:margin-bottom="0.125in"/>
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties fo:font-style="normal" style:font-style-asian="normal" style:font-style-complex="normal"/>
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties fo:font-style="normal" fo:font-weight="normal" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-style-complex="normal" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T3" style:family="text">
<style:text-properties fo:font-style="normal" fo:font-weight="normal" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-name-complex="David" style:font-style-complex="normal" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T4" style:family="text">
<style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="T5" style:family="text">
<style:text-properties fo:font-weight="normal" style:font-weight-asian="normal" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T6" style:family="text">
<style:text-properties fo:font-style="italic" fo:font-weight="normal" style:font-style-asian="italic" style:font-weight-asian="normal" style:font-style-complex="italic" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T7" style:family="text">
<style:text-properties style:font-name="DejaVu Sans" fo:font-style="normal" fo:font-weight="normal" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-style-complex="normal" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T8" style:family="text">
<style:text-properties style:font-name="Code2001" fo:font-style="normal" fo:font-weight="normal" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-style-complex="normal" style:font-weight-complex="normal"/>
</style:style>
<style:style style:name="T9" style:family="text">
<style:text-properties style:font-name="DejaVu Sans" fo:font-style="normal" fo:font-weight="normal" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-style-complex="normal" style:font-weight-complex="normal"/>
</style:style>
</office:automatic-styles>
<office:body>
<office:text>
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="Title"><xsl:value-of select="ser:header/ser:title"/></text:p>
<text:p text:style-name="Author"><xsl:value-of select="ser:header/ser:author"/></text:p>
<text:p text:style-name="Liturgical_20_Occasion"><xsl:value-of select="ser:header/ser:occasion"/></text:p>
<text:p text:style-name="Date"><xsl:value-of select="ser:header/ser:date"/></text:p>
<text:p text:style-name="Text">Text: <text:span text:style-name="T1"><xsl:value-of select="ser:header/ser:text"/></text:span></text:p>
<xsl:apply-templates select="ser:body/*" mode="body"/>
</office:text>
</office:body>
</office:document-content>
</xsl:template>
</xsl:transform>

106
data/plain-html.xsl Normal file
View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
exclude-result-prefixes="ser"
version="1.0">
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
cdata-section-elements="style" indent="yes" encoding="utf-8" />
<xsl:variable name="refnum">0</xsl:variable>
<xsl:template match="ser:link" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:br" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<br />
</xsl:template>
<xsl:template match="ser:em" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<em><xsl:apply-templates select="*|text()"/></em>
</xsl:template>
<xsl:template match="ser:strong" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<strong><xsl:apply-templates select="*|text()"/></strong>
</xsl:template>
<xsl:template match="ser:greek" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="greek"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:unicode" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<span class="unicode"><xsl:apply-templates select="*|text()"/></span>
</xsl:template>
<xsl:template match="ser:cite" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:element name="a" namespace="http://www.w3.org/1999/xhtml">
<xsl:attribute name="class">ref</xsl:attribute>
<xsl:attribute name="href">#ref<xsl:value-of select="@number"/></xsl:attribute>
<xsl:value-of select="@number"/>
</xsl:element>
</xsl:template>
<xsl:template match="ser:ref" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<li class="reference">
<xsl:attribute name="id">ref<xsl:value-of select="@number" /></xsl:attribute>
<xsl:apply-templates select="*|text()"/>
</li>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<xsl:choose>
<xsl:when test="@xml:space='preserve'"><pre><xsl:apply-templates select="*|text()"/></pre></xsl:when>
<xsl:otherwise>
<p><xsl:apply-templates select="*|text()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ser:quote" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<blockquote><xsl:apply-templates select="*|text()"/></blockquote>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon" xmlns="http://www.w3.org/1999/xhtml" xmlns:ser="urn:david-sermon">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><xsl:value-of select="ser:header/ser:title"/></title>
</head>
<body>
<div id="header">
<h1 id="title"><xsl:value-of select="ser:header/ser:title"/></h1>
<h2 id="author"><xsl:value-of select="ser:header/ser:author"/></h2>
<h3 id="occasion"><xsl:value-of select="ser:header/ser:occasion"/></h3>
<h3 id="place"><xsl:value-of select="ser:header/ser:place"/></h3>
<h3 id="date"><xsl:value-of select="ser:header/ser:date"/></h3>
</div>
<div id="body">
<p id="text"><em>Text:</em> <xsl:value-of select="ser:header/ser:text"/></p>
<xsl:apply-templates select="ser:body/*" />
</div>
<xsl:if test="count(ser:footer/ser:ref) &gt; 0">
<div id="footer">
<ol class="references">
<xsl:apply-templates select="ser:footer/ser:ref" />
</ol>
</div>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:transform>

115
data/rtf.xsl Normal file
View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="us-ascii"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ser="urn:david-sermon"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ser:br">
<fo:line-break />
</xsl:template>
<xsl:template match="ser:em">
<fo:inline font-style="italic"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:strong">
<fo:inline font-weight="bold"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:greek">
<fo:inline font-family="PalatinoLinotype"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:hebrew">
<fo:inline font-family="David"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:unicode">
<fo:inline font-family="DejaVuSerif"><xsl:apply-templates select="*|text()"/></fo:inline>
</xsl:template>
<xsl:template match="ser:cite">
<fo:inline vertical-align="super" font-size="66%">&#xa0;<xsl:value-of select="@number"/></fo:inline>
</xsl:template>
<xsl:template match="ser:ref">
<fo:list-item font-size="12pt">
<fo:list-item-label>
<fo:block line-height="150%" font-size="10pt" text-indent="0.125in"><xsl:value-of select="@number"/>.</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:apply-templates select="*|text()" mode="reference" />
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!-- match block-level elements in body -->
<xsl:template match="ser:p" mode="body">
<fo:block line-height="150%" text-indent="0.5in"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:p" mode="quote">
<fo:block line-height="125%" font-size="11pt" text-indent="0" space-after="0.125in"><xsl:if test="@xml:space='preserve'"><xsl:attribute name="white-space">pre</xsl:attribute></xsl:if><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:p" mode="reference">
<fo:block line-height="150%" font-size="10pt" margin-left="0.4in" text-indent="-0.125in" margin-bottom="0.125in" text-align="left"><xsl:apply-templates select="*|text()"/></fo:block>
</xsl:template>
<xsl:template match="ser:quote" mode="body">
<fo:block margin-left="0.5in" margin-right="0.5in" space-before="0.125in" space-after="0.125in"><xsl:apply-templates select="*|text()" mode="quote"/></fo:block>
</xsl:template>
<!-- match toplevel element -->
<xsl:template match="/ser:sermon">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="letter"
page-width="8.5in"
page-height="11in"
margin="0.5in">
<!-- Page template goes here -->
<fo:region-body margin="0.5in" />
<fo:region-after extent="0.5in" margin="0in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="letter" font-family="'Times New Roman', serif">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="center" font-size="16pt">Page <fo:page-number/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" text-align="justify">
<fo:block text-align="center" font-size="20pt" font-weight="bold" space-after="0.25in"><xsl:value-of select="ser:header/ser:title"/></fo:block>
<fo:block text-align="center" font-size="16pt" space-after="0.25in"><xsl:value-of select="ser:header/ser:author"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:place"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:occasion"/></fo:block>
<fo:block text-align="center" font-size="16pt" font-style="italic"><xsl:value-of select="ser:header/ser:date"/></fo:block>
<fo:block line-height="150%" space-before="1em" space-after="1em"><fo:inline font-style="italic">Text:</fo:inline>&#xa0;<xsl:value-of select="ser:header/ser:text"/></fo:block>
<xsl:apply-templates select="ser:body/*" mode="body">
</xsl:apply-templates>
<fo:block margin-top="1in">
<xsl:if test="count(ser:footer/ser:ref) > 0">
<fo:leader leader-length="2in" leader-pattern="rule" rule-thickness="0.1mm" rule-style="solid" color="black"/>
<fo:list-block>
<xsl:apply-templates select="ser:footer/ser:ref" />
</fo:list-block>
</xsl:if>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:transform>

42
data/sermon.dtd Normal file
View File

@@ -0,0 +1,42 @@
<!ENTITY % markup "em | strong | greek | unicode">
<!ENTITY % bodymarkup "%markup; | cite | br | link">
<!ENTITY % block "p | quote">
<!-- PUNCTUATION -->
<!ENTITY lsquo "&#8216;">
<!ENTITY rsquo "&#8217;">
<!ENTITY mdash "&#8212;">
<!ENTITY ldquo "&#8220;">
<!ENTITY rdquo "&#8221;">
<!ELEMENT sermon (header,body,footer?)>
<!-- HEADER -->
<!ELEMENT header (title|author|place|occasion|date|text)*>
<!ELEMENT title (#PCDATA|%markup;)*>
<!ELEMENT author (#PCDATA)>
<!ELEMENT place (#PCDATA)>
<!ELEMENT occasion (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT text (#PCDATA)>
<!-- BODY -->
<!ELEMENT body (%block;)*>
<!ELEMENT p (#PCDATA|%bodymarkup;)*>
<!ATTLIST p xml:space (preserve|default) "default">
<!ELEMENT br EMPTY>
<!ELEMENT em (#PCDATA|%bodymarkup;)*>
<!ELEMENT strong (#PCDATA|%bodymarkup;)*>
<!ELEMENT greek (#PCDATA|%bodymarkup;)*>
<!ELEMENT unicode (#PCDATA|%bodymarkup;)*>
<!ELEMENT cite EMPTY>
<!ATTLIST cite number CDATA #REQUIRED>
<!ELEMENT quote (%block;)*>
<!ATTLIST quote number CDATA #IMPLIED>
<!ELEMENT link (#PCDATA|%bodymarkup;)*>
<!ATTLIST link href CDATA #REQUIRED>
<!-- FOOTER -->
<!ELEMENT footer (ref)*>
<!ELEMENT ref (%block;)*>
<!ATTLIST ref number CDATA #REQUIRED>