<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="1.0" exclude-result-prefixes="dtb">
<xsl:output encoding="utf-8" method="xml" version="1.0" indent="no" doctype-public="-//NISO//DTD dtbook 2005-2//EN" doctype-system="http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd"/>
<xsl:template match="dtb:dtbook">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="local-name()='version'">
<xsl:attribute name="version">2005-2</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="dtb:frontmatter">
<xsl:copy>
<xsl:call-template name="killStyle"/>
<xsl:apply-templates select="dtb:doctitle"/>
<xsl:apply-templates select="dtb:covertitle "/>
<xsl:apply-templates select="dtb:docauthor"/>
<xsl:apply-templates select="dtb:level | dtb:level1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="dtb:bdo">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="local-name()='lang'">
<xsl:attribute name="xml:lang"><xsl:value-of select="."/></xsl:attribute>
</xsl:when>
<xsl:when test="local-name()!='style'">
<xsl:copy-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:call-template name="killStyle"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template name="killStyle">
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="local-name()!='style'">
<xsl:copy-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="comment()|text()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>