Print

Print


My example had a typo - I tested it, fixed the typo, but then sent the
original untested template. Here it is, corrected:

<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="titlePage//*[lb]/text()">

	<xsl:variable 
		name="current-title-page-id" 
		select="generate-id(ancestor::titlePage)"/>

	<xsl:variable 
		name="preceding-line-breaks" 
		select="preceding::lb[
	
generate-id(ancestor::titlePage)=$current-title-page-id
		]"/>

	<xsl:element name="span">
		<xsl:attribute name="class">
			<xsl:value-of select="concat('line-',
1+count($preceding-line-breaks))"/>
		</xsl:attribute>
		<xsl:value-of select="."/>
	</xsl:element>

</xsl:template>

</xsl:stylesheet>