Liste de liens :
Liste de liens :
<xsl:template match="tei:w"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:attribute name="ref"><xsl:value-of select="concat(ancestor::tei:text/@id,', p. ',preceding::tei:pb[1]/@n)"/></xsl:attribute> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="w"> <xsl:variable name="nextLb"> <xsl:choose> <xsl:when test="following-sibling::lb[@rend='hyphen']"> <xsl:apply-templates select="following-sibling::lb[@rend='hyphen'][1]" mode="position"/> </xsl:when> <xsl:otherwise>99999999</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="nextW1"> <xsl:choose> <xsl:when test="following-sibling::w[1]"> <xsl:apply-templates select="following-sibling::w[1]" mode="position"/> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="nextW2"> <xsl:choose> <xsl:when test="following-sibling::w[2]"> <xsl:apply-templates select="following-sibling::w[2]" mode="position"/> </xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="following::w[1][matches(.,'^\s*-\s*$')] and ($nextW2 > $nextLb)"> <w> <xsl:apply-templates select="@*"/> <xsl:value-of select="normalize-space(.)"/><lb rend="hyphen"/><xsl:value-of select="normalize-space(following::w[2])"/> </w> </xsl:when> <xsl:when test="not(matches(.,'^\s*-\s*$')) and following-sibling::*[1][self::lb[@rend='hyphen']]"> <w> <xsl:apply-templates select="@*"/> <xsl:value-of select="normalize-space(.)"/><lb rend="hyphen"/><xsl:value-of select="normalize-space(following::w[1])"/> </w> </xsl:when> <xsl:when test="matches(.,'^\s*-\s*$') and ($nextW1 > $nextLb)"> <xsl:comment>trait d'union effacé</xsl:comment> </xsl:when> <xsl:when test="preceding-sibling::*[1][self::lb[@rend='hyphen']]"> <xsl:comment>fin de mot coupé : <xsl:value-of select="."/></xsl:comment> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template>