comparison summa/bilingual/merge.xsl @ 133:b1163b317cd4

handle more Replies, now using regex
author ht
date Sat, 16 Nov 2024 09:43:19 +0000
parents c910f10a8e83
children
comparison
equal deleted inserted replaced
132:c352b56f8053 133:b1163b317cd4
55 </xsl:copy> 55 </xsl:copy>
56 </xsl:when> 56 </xsl:when>
57 <xsl:otherwise> 57 <xsl:otherwise>
58 <xsl:message>Can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="count(x:p)"/>!=<xsl:value-of select="count($lp)"/></xsl:message> 58 <xsl:message>Can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="count(x:p)"/>!=<xsl:value-of select="count($lp)"/></xsl:message>
59 <!-- Try to split on keywords in English --> 59 <!-- Try to split on keywords in English -->
60 <xsl:variable name="pb" select="count(x:p/x:b[starts-with(.,'Objection') or (.='On the contrary,') or (.='I answer that,') or starts-with(.,'Reply to ')])"/> 60 <xsl:variable name="pb" select="count(x:p/x:b[matches(.,
61 '^(Objection|On the contrary,|I answer that|Reply to )')]) + count(x:p[matches(.,'^ ?(Hence the Reply|This suffices for the Repl(y|ies))')])"/>
61 <xsl:choose> 62 <xsl:choose>
62 <xsl:when test="$pb=count($lp)"> 63 <xsl:when test="$pb=count($lp)">
63 <xsl:copy> 64 <xsl:copy>
64 <xsl:apply-templates select="@*|x:h4"/> 65 <xsl:apply-templates select="@*|x:h4"/>
65 <xsl:for-each-group select="x:p" group-starting-with="x:p[x:b[starts-with(.,'Objection') or (.='On the contrary,') or (.='I answer that,') or starts-with(.,'Reply to ')]]"> 66 <xsl:for-each-group select="x:p" group-starting-with="x:p[matches(x:b,'^(Objection|On the contrary,|I answer that|Reply to )') or matches(.,' ?(Hence the Reply|This suffices for the Repl(y|ies))')]">
66 <xsl:variable name="i" select="position()"/> 67 <xsl:variable name="i" select="position()"/>
67 <xsl:call-template name="doBi"> 68 <xsl:call-template name="doBi">
68 <xsl:with-param select="current-group()" name="english"/> 69 <xsl:with-param select="current-group()" name="english"/>
69 <xsl:with-param select="$lp[position()=$i]" name="latin"/> 70 <xsl:with-param select="$lp[position()=$i]" name="latin"/>
70 </xsl:call-template> 71 </xsl:call-template>