<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dtb="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 match="dtb:p[dtb:p and count(node()[ (self::text() and normalize-space()='') or self::dtb:p or self::comment() or self::processing-instruction() ])=count(node())]"> <xsl:message terminate="no">Removed a nested paragraph</xsl:message> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet>