<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dtb="http://www.daisy.org/z3986/2005/dtbook/" version="2.0"> <xsl:include href="recursive-copy2.xsl"/> <xsl:include href="output2.xsl"/> <xsl:template match="dtb:pagenum[@page='normal' and not(matches(.,'^\s*\d+\s*$','s'))]"> <xsl:choose> <xsl:when test="ancestor::dtb:frontmatter and matches(.,'^\s*[Mm]*([Dd]?[Cc]{0,3}|[Cc][DdMm])([Ll]?[Xx]{0,3}|[Xx][LlCc])([Vv]?[Ii]{0,3}|[Ii][VvXx])\s*$','s')"> <xsl:message>changing page="normal" to page="front"</xsl:message> <xsl:copy> <xsl:attribute name="page">front</xsl:attribute> <xsl:copy-of select="@*[local-name()!='page']"/> <xsl:apply-templates/> </xsl:copy> </xsl:when> <xsl:otherwise> <xsl:message>changing page="normal" to page="special"</xsl:message> <xsl:copy> <xsl:attribute name="page">special</xsl:attribute> <xsl:copy-of select="@*[local-name()!='page']"/> <xsl:apply-templates/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="dtb:pagenum[@page='front' and not(matches(.,'(^\s*[Mm]*([Dd]?[Cc]{0,3}|[Cc][DdMm])([Ll]?[Xx]{0,3}|[Xx][LlCc])([Vv]?[Ii]{0,3}|[Ii][VvXx])\s*$)|(^\s*\d+\s*$)','s'))]"> <xsl:message>changing page="front" to page="special"</xsl:message> <xsl:copy> <xsl:attribute name="page">special</xsl:attribute> <xsl:copy-of select="@*[local-name()!='page']"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet>