MovePB.xslt

The Best Practices for TEI in Libraries produced by the TEI SIG:Libraries is a helpful document indeed. However, there is at least one recommendation made with which I vehemently disagree: that a page break that occurs between divisions be encoded at the top of the following division, rather than between them (or at the bottom of the previous division, which would be just as bad). See section 3.6.

This stylesheet moves &lt;pb> elements placed as the first child of a &lt;div> to just before the start-tag of said &lt;div>.

 

       

 <xsl:apply-templates select="child::pb[1]"/>  <xsl:apply-templates select="@*"/> <xsl:apply-templates select="node[          not( . is current/child::pb[1] )           ]"/> </xsl:copy> </xsl:template>

</xsl:stylesheet>