Count Metrical Lines P4.xslt

Counting  elements in a TEI document is pretty easy. But when a metrical line is broken in order to handle overlap, e.g., often two or more TEI  elements are used to represent a single metrical line. There are several mechanisms for indicating this fact, two of the more common of which are the use of the part= attribute and the use of the next= & prev= attributes. This stylesheet counts metrical lines in a TEI P4 document, taking into consideration those that have been encoded using several  elements using these mechanisms. It does not take other mechanisms (e.g., ) into account. 





  

 There are    metrical lines in “  ”</xsl:text> <xsl:variable name="incomplete" select="count(.//l[@part='Y'])"/> <xsl:if test="$incomplete > 0"> , of which </xsl:text> <xsl:value-of select="$incomplete"/> <xsl:choose> <xsl:when test="$incomplete = 1">  is</xsl:text> </xsl:when> <xsl:otherwise>  are</xsl:text> </xsl:otherwise> </xsl:choose>  incomplete</xsl:text> </xsl:if> .</xsl:text> </xsl:template>

 <xsl:apply-templates/> </xsl:template>  </xsl:stylesheet>