- Does not format MathML yet.
- Does not handle videodata or audiodata yet.
- Handles SVG with external viewer.
+
+
+EPUB metadata
+========================
+The info child of the document's root element is used
+by the stylesheet to create EPUB metadata. Note that
+metadata is plain text, so element content is converted
+to text using the XSL normalize-space() function.
+
+Here is the current mapping of info elements to EPUB
+metadata. Any others are ignored for metadata, but
+may appear on the EPUB HTML titlepage, depending on the
+titlepage customization.
+
+NOTE: the <dc:*> elements (not attributes of meta) duplicate
+the meta elements for backwards compatibility, per the
+EPUB3 specification. They can be turned off with the
+$epub.include.optional.metadata.dc.elements parameter.
+
+abstract
+---------
+The content must be converted to a text string for the
+OPF metadata. The stylesheet converts only title, para,
+formalpara, and simpara children in an abstract. All other
+child elements are ignored. It puts any title first.
+The OPF output appears as:
+
+<meta property="dcterms:description">title: abstract text</meta>
+<dc:description>title: abstract text</dc:description>
+
+
+author
+-------
+If uses a personname child, then it applies the
+DocBook XSL person.name template to arrange the name.
+Otherwise processes org or orgname into the content.
+Then it outputs:
+
+<meta id="meta-creator1" property="dcterms:creator">Firstname Surname</meta>
+<dc:creator id="pub-creator1">Firstname Surname</dc:creator>
+
+If there are multiple authors, the number in the id attribute
+is incremented each time.
+
+
+authorgroup
+-------------
+Applies templates to all of its children.
+
+
+bibliocoverage
+---------------
+<meta property="dcterms:coverage">bibliocoverage text</meta>
+<dc:coverage>bibliocoverage text</dc:coverage>
+
+
+biblioid
+--------------
+This usually has @class="isbn" for the ISBN number. It is used
+as the EPUB3 unique-identifier. That isbn value
+is also output as follows:
+
+<meta id="meta-identifier" property="dcterms:identifier">urn:isbn:value</meta>
+<dc:identifier id="pub-identifier">urn:isbn:value</dc:identifier>
+
+A biblioid element with other class names are converted in a similar manner.
+
+
+bibliorelation
+----------------
+<meta property="dcterms:relation">bibliorelation text</meta>
+<dc:relation>bibliorelation text</dc:relation>
+
+
+bibliosource
+----------------
+<meta property="dcterms:source">bibliosource text</meta>
+<dc:source>bibliosource text</dc:source>
+
+
+collab
+------------
+If a personname child is used, then it calls the
+person.name template, otherwise is uses the orgname or
+collabname text.
+
+<meta property="dcterms:contributor">collab text</meta>
+<dc:contributor>collab text</dc:contributor>
+
+
+copyright
+-------------
+Arranges the copyright elements into a text string with
+copyright symbol, dates, and holder, and then
+generates:
+
+<meta property="dcterms:right">Copyright text</meta>
+<dc:right>Copyright text</dc:right>
+
+Also, if there is no info/date element, then the copyright
+year is used to generate:
+
+<meta property="dcterms:date">year</meta>
+<dc:date>year</dc:date>
+
+
+corpauthor
+------------
+<meta id="meta-creator1" property="dcterms:creator">corpauthor text</meta>
+<dc:creator id="pub-creator1">corpauthor text</dc:creator>
+
+
+corpcredit
+------------
+<meta property="dcterms:contributor">corpcredit text</meta>
+<dc:contributor>corpcredit text</dc:contributor>
+
+
+date
+-------------
+<meta property="dcterms:date">date text</meta>
+<dc:date>date text</dc:date>
+
+See also: copyright.
+
+
+editor
+--------------
+If a personname child is used, then it calls the
+person.name template, otherwise is uses the orgname text.
+
+An editor can be considered as either a creator (when there
+is no author) or a contributor. The stylesheet parameter
+'editor.property' can be set to either 'creator' or
+'contributor' (default) at runtime. So the output is either:
+
+<meta property="dcterms:contributor">editor text</meta>
+<dc:contributor>editor text</dc:contributor>
+
+or
+
+<meta property="dcterms:creator">editor text</meta>
+<dc:creator>editor text</dc:creator>
+
+
+isbn, issn, etc.
+-----------------
+Handled like biblioid @class="isbn".
+
+
+keyword
+-----------
+<meta property="dcterms:subject">keyword text</meta>
+<dc:subject>keyword text</dc:subject>
+
+
+keywordset
+------------
+Applies templates to its children.
+
+
+othercredit
+------------
+Handled like collab.
+
+
+pubdate
+------------
+Handled like date.
+
+
+publisher
+--------------
+Applies templates only to publishername.
+
+
+publishername
+---------------
+<meta property="dcterms:publisher">publishername text</meta>
+<dc:publisher>publishername text</dc:publisher>
+
+
+subjectset
+--------------
+Applies templates to subject/subjecterm descendants.
+
+
+subjectterm
+------------------
+<meta property="dcterms:subject">subjecterm text</meta>
+<dc:subject>subjecterm text</dc:subject>
+
<xsl:template match="author|corpauthor" mode="opf.metadata">
<xsl:variable name="n">
- <xsl:call-template name="person.name">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="self::corpauthor">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="org/orgname">
+ <xsl:apply-templates select="org/orgname"/>
+ </xsl:when>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="person.name">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
<xsl:if test="string-length($n) != 0">
</xsl:template>
<xsl:template match="editor" mode="opf.metadata">
+ <xsl:variable name="n">
+ <xsl:choose>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="person.name">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="string-length($editor.property) != 0">
<xsl:text>dcterms:</xsl:text>
<xsl:value-of select="$name"/>
</xsl:attribute>
- <xsl:value-of select="normalize-space(.)"/>
+ <xsl:value-of select="normalize-space($n)"/>
</xsl:element>
<xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
<xsl:choose>
<xsl:when test="$name = 'creator'">
<dc:creator>
- <xsl:value-of select="normalize-space(.)"/>
+ <xsl:value-of select="normalize-space($n)"/>
</dc:creator>
</xsl:when>
<xsl:when test="$name = 'contributor'">
<dc:contributor>
- <xsl:value-of select="normalize-space(.)"/>
+ <xsl:value-of select="normalize-space($n)"/>
</dc:contributor>
</xsl:when>
<xsl:otherwise>
<xsl:element namespace="{$dc.namespace}" name="{$name}">
- <xsl:value-of select="normalize-space(.)"/>
+ <xsl:value-of select="normalize-space($n)"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<xsl:template match="othercredit|corpcredit|collab" mode="opf.metadata">
+<xsl:template match="corpcredit" mode="opf.metadata">
<xsl:element name="meta" namespace="{$opf.namespace}">
<xsl:attribute name="property">dcterms:contributor</xsl:attribute>
<xsl:value-of select="normalize-space(.)"/>
<xsl:value-of select="normalize-space(.)"/>
</dc:contributor>
</xsl:if>
+</xsl:template>
+
+<xsl:template match="collab|othercredit" mode="opf.metadata">
+ <xsl:variable name="content">
+ <xsl:choose>
+ <xsl:when test="collabname">
+ <xsl:apply-templates select="collabname"/>
+ </xsl:when>
+ <xsl:when test="org/orgname">
+ <xsl:apply-templates select="org/orgname"/>
+ </xsl:when>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:when test="personname|firstname|surname|othername">
+ <xsl:call-template name="person.name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:contributor</xsl:attribute>
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:contributor>
+ <xsl:value-of select="normalize-space($content)"/>
+ </dc:contributor>
+ </xsl:if>
</xsl:template>