<
xsl:stylesheet xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform" xmlns:dtb=
"http://www.daisy.org/z3986/2005/dtbook/" xmlns=
"http://www.daisy.org/z3986/2005/dtbook/" version=
"2.0" exclude-result-prefixes=
"dtb">
<
xsl:include href=
"recursive-copy.xsl"/>
<
xsl:include href=
"output.xsl"/>
<
xsl:template name=
"insertDoctitle">
<
xsl:choose>
<
xsl:when test=
"not(//dtb:frontmatter/dtb:doctitle)">
<
xsl:choose>
<
xsl:when test=
"//dtb:meta[@name='dc:Title'][1]/@content!=''">
<
xsl:element name=
"doctitle">
<
xsl:value-of select=
"//dtb:meta[@name='dc:Title'][1]/@content"/>
</
xsl:element>
</
xsl:when>
<
xsl:when test=
"//dtb:doctitle">
<
xsl:copy-of select=
"(//dtb:doctitle)[1]"/>
</
xsl:when>
</
xsl:choose>
</
xsl:when>
<
xsl:otherwise>
<
xsl:copy-of select=
"(//dtb:frontmatter/dtb:doctitle)[1]"/>
</
xsl:otherwise>
</
xsl:choose>
</
xsl:template>
<
xsl:template name=
"insertDocauthor">
<
xsl:choose>
<
xsl:when test=
"not(//dtb:frontmatter/dtb:docauthor)">
<
xsl:for-each select=
"//dtb:meta[@name='dc:Creator']">
<
xsl:if test=
"@content!=''">
<
xsl:element name=
"docauthor">
<
xsl:value-of select=
"@content"/>
</
xsl:element>
</
xsl:if>
</
xsl:for-each>
</
xsl:when>
<
xsl:otherwise>
<
xsl:copy-of select=
"//dtb:frontmatter/dtb:docauthor"/>
</
xsl:otherwise>
</
xsl:choose>
</
xsl:template>
<
xsl:template match=
"dtb:frontmatter">
<
xsl:copy>
<
xsl:copy-of select=
"@*"/>
<
xsl:call-template name=
"insertDoctitle"/>
<
xsl:apply-templates select=
"dtb:covertitle"/>
<
xsl:call-template name=
"insertDocauthor"/>
<
xsl:apply-templates select=
"*[not(local-name()='covertitle' and namespace-uri()='http://www.daisy.org/z3986/2005/dtbook/')]"/>
</
xsl:copy>
</
xsl:template>
<
xsl:template match=
"dtb:frontmatter/dtb:doctitle">
<
xsl:choose>
<
xsl:when test=
"not(preceding::dtb:doctitle)"></
xsl:when>
<
xsl:otherwise>
<
xsl:copy>
<
xsl:copy-of select=
"@*"/>
</
xsl:copy>
</
xsl:otherwise>
</
xsl:choose>
</
xsl:template>
<
xsl:template match=
"dtb:frontmatter/dtb:docauthor">
</
xsl:template>
</
xsl:stylesheet>