Stylesheet
epub-common.xsl
Documentation
Description
TEI stylesheet for making ePub output.
This software is dual-licensed:
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
Unported License http://creativecommons.org/licenses/by-sa/3.0/
2. http://www.opensource.org/licenses/BSD-2-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This software is provided by the copyright holders and contributors
"as is" and any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for
a particular purpose are disclaimed. In no event shall the copyright
holder or contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use,
data, or profits; or business interruption) however caused and on any
theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such damage.
Author: See AUTHORS
Copyright: 2013, TEI Consortium
Imported from
Stylesheet version
3.0
Template
stdfooter
Template
generateLicence
Template
generateLanguage
Template
generateSubject
Template
generateSubjectHook
Template
generateID
Template
verbatim-lineBreak
Template
purgeCSS
Documentation
Description [epub] Remove unwanted things from CSS
Namespace
No namespace
Used by
Import precedence
15
Source
<xsl:template name= "purgeCSS" >
<xsl:choose >
<xsl:when test= "starts-with(.,'@import')" />
<!--
<xsl:when test="contains(.,'max-width:')"/>
<xsl:when test="contains(.,'height:')"/>
<xsl:when test="contains(.,'line-height:')"/>
<xsl:when test="contains(.,'clear:')"/>
<xsl:when test="contains(.,'padding')"/>
<xsl:when test="contains(.,'float:')"/>
<xsl:when test="contains(.,'font-size:')"/>
<xsl:when test="contains(.,'width:')"/>
<xsl:when test="contains(.,'margin')"/>
<xsl:when test="contains(.,'border')"/>
-->
<xsl:otherwise >
<xsl:value-of select= "." />
<xsl:text >
</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Stylesheet location
../../../epub/epub-common.xsl
Template
addLangAtt
Template
tei:lb[tei:match(@rend,'space')]
Template
tei:titleStmt metadata
Template
tei:editionStmt metadata
Template
tei:publicationStmt metadata
Template
tei:seriesStmt metadata
Template
tei:notesStmt metadata
Template
tei:sourceDesc metadata
Template
tei:encodingDesc metadata
Template
tei:listPrefixDef metadata
Template
tei:tagsDecl metadata
Template
tei:projectDesc metadata
Template
tei:editorialDecl metadata
Template
tei:classDecl metadata
Template
tei:sourceDesc/tei:bibl metadata
Template
tei:sourceDesc/tei:biblFull metadata
Template
tei:respStmt metadata
Template
tei:list metadata
Template
tei:item metadata
Template
tei:relatedItem[@target] metadata
Template
tei:extent metadata
Template
tei:authority metadata
Template
tei:publicationStmt/tei:address metadata
Template
tei:publicationStmt/tei:publisher metadata
Template
tei:publicationStmt/tei:pubPlace metadata
Template
tei:distributor metadata
Template
tei:editor metadata
Template
tei:funder metadata
Template
tei:idno metadata
Template
tei:availability[not(@n) and preceding-sibling::tei:availability/@n] metadata
Template
tei:availability metadata
Template
tei:licence metadata
Template
tei:title metadata
Template
tei:date metadata
Template
tei:bibl/tei:date metadata
Template
tei:note metadata
Template
tei:notesStmt/tei:note metadata
Template
tei:listPerson metadata
Template
tei:sourceDesc/tei:bibl/* metadata
Template
* metadata
Template
tei:seriesStmt/tei:p
Template
tei:distributor/tei:name
Template
tei:distributor/tei:address
Template
tei:authority/tei:address
Template
tei:authority/tei:addrLine
Template
tei:title[@type='uniform']
Template
tei:editionStmt/tei:p
Template
tei:editor
Template
tei:title[@type='main']
Template
tei:title[@type='alternative']
Template
generateDate
Template
tei:front/tei:titlePage
Template
html:li
Template
javascriptHook
Template
epubSpineHook
Template
epubManifestHook
Template
processTEIHook
Template
includeCSS
Template
linkCSS
Template
hdr3
Template
getgraphics
Namespace
No namespace
Used by
References
Parameters
Keys
Functions
Import precedence
15
Source
<xsl:template name= "getgraphics" >
<xsl:result-document href= "{concat($directory,'/copy.xml')}" >
<project xmlns= "" basedir= "." default= "dist" name= "imagecopy" >
<target name= "dist" >
<xsl:variable name= "contents" >
<xsl:if test= "not($coverimage='')" >
<copy toFile= "{$coverDir}/{tokenize($coverimage,'/')[last()]}" file= "{$coverimage}" />
</xsl:if>
<xsl:if test= "$mediaoverlay='true' and key('Timeline',1)" >
<xsl:for-each select= "key('Timeline',1)" >
<xsl:variable name= "target" >
<xsl:value-of select= "replace($outputDir,'file:///','')" />
<xsl:text > / </xsl:text>
<xsl:value-of select= "$mediaDir" />
<xsl:text > /audio </xsl:text>
<xsl:number level= "any" />
<xsl:text > . </xsl:text>
<xsl:value-of select= "tokenize(@corresp,'\.')[last()]" />
</xsl:variable>
<copy toFile= "{$target}" file= "{$inputDir}/{@corresp}" />
</xsl:for-each>
</xsl:if>
<xsl:for-each select= "key('PB',1)" >
<xsl:choose >
<xsl:when test= "tei:match(@rend,'none')" />
<xsl:when test= "not(@facs)" />
<xsl:when test= "starts-with(@facs,'tcp:')" />
<xsl:when test= "starts-with(@facs,'unknown:')" />
<xsl:otherwise >
<xsl:variable name= "F" >
<xsl:choose >
<xsl:when test= "starts-with(@facs,'#')" >
<xsl:if test= "empty(id(substring(@facs, 2)))" >
<xsl:message > The target ' <xsl:value-of select= "@facs" /> ' is not defined in this document </xsl:message>
</xsl:if>
<xsl:for-each select= "id(substring(@facs,2))" >
<xsl:value-of select= "tei:resolveURI(.,descendant-or-self::*[@url][1]/@url)" />
</xsl:for-each>
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "tei:resolveURI(.,@facs)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name= "target" >
<xsl:value-of select= "replace($outputDir,'file:///','')" />
<xsl:text > / </xsl:text>
<xsl:value-of select= "$mediaDir" />
<xsl:text > /pageimage </xsl:text>
<xsl:number level= "any" />
<xsl:text > . </xsl:text>
<xsl:value-of select= "tokenize($F,'\.')[last()]" />
</xsl:variable>
<xsl:choose >
<xsl:when test= "$F = ''" >
<xsl:message > Unable to determine source file name of ' <xsl:value-of select= "@facs" /> '" </xsl:message>
</xsl:when>
<xsl:when test= "contains($F,':')" >
<get src= "{$F}" dest= "{$target}" />
</xsl:when>
<xsl:when test= "starts-with($F,'/')" >
<copy toFile= "{$target}" file= "{@url}" />
</xsl:when>
<xsl:otherwise >
<copy toFile= "{$target}" file= "{$inputDir}/{$F}" />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select= "tokenize($extraGraphicsFiles,',')" >
<xsl:variable name= "target" >
<xsl:value-of select= "replace($outputDir,'file:///','')" />
<xsl:text > / </xsl:text>
<xsl:value-of select= "tokenize(.,'/')[last()]" />
</xsl:variable>
<xsl:choose >
<xsl:when test= "contains(.,':')" >
<get src= "{.}" dest= "{$target}" />
</xsl:when>
<xsl:when test= "starts-with(.,'/')" >
<copy toFile= "{$target}" file= "{.}" />
</xsl:when>
<xsl:otherwise >
<copy toFile= "{$target}" file= "{$inputDir}/{.}" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select= "key('G',1)" >
<xsl:variable name= "F" >
<xsl:value-of select= "@url" />
</xsl:variable>
<xsl:variable name= "target" >
<xsl:value-of select= "replace($outputDir,'file:///','')" />
<xsl:text > / </xsl:text>
<xsl:value-of select= "$mediaDir" />
<xsl:text > /resource </xsl:text>
<xsl:number level= "any" />
<xsl:text > . </xsl:text>
<xsl:value-of select= "tokenize($F,'\.')[last()]" />
</xsl:variable>
<xsl:choose >
<xsl:when test= "contains($F,':')" >
<get src= "{$F}" dest= "{$target}" />
</xsl:when>
<xsl:when test= "starts-with($F,'/')" >
<copy toFile= "{$target}" file= "{@url}" />
</xsl:when>
<xsl:otherwise >
<copy toFile= "{$target}" file= "{$inputDir}/{@url}" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:if test= "not($contents='')" >
<mkdir >
<xsl:attribute name= "dir" >
<xsl:value-of select= "replace($outputDir,'file:///','')" />
<xsl:text > / </xsl:text>
<xsl:value-of select= "$mediaDir" />
</xsl:attribute>
</mkdir>
</xsl:if>
<xsl:copy-of select= "$contents" />
</target>
</project>
</xsl:result-document>
</xsl:template>
Stylesheet location
../../../epub/epub-common.xsl
Parameter
mediaoverlay
Parameter
coverimage
Parameter
coverDir
Parameter
filePerPage
Parameter
mediaDir
Parameter
javascriptFiles
Parameter
extraGraphicsFiles
Parameter
pagebreakStyle
Parameter
epubMimetype
Key
G
Key
GRAPHICS
Key
PBGRAPHICS
Key
Timeline
Key
Object
Key
objectOnPage
Key
PB