changeset 61:bfebbcb9ddf1

allow for multi-para s.c. div in latin
author ht
date Sun, 03 Jan 2010 14:24:58 +0000
parents 206e94730bf0
children 65a42d281c99
files summa/bilingual/merge.xsl
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/summa/bilingual/merge.xsl	Sat Jan 02 17:48:01 2010 +0000
+++ b/summa/bilingual/merge.xsl	Sun Jan 03 14:24:58 2010 +0000
@@ -31,36 +31,37 @@
   <!-- Wraps a single article within a question -->
   <xsl:variable name="n" select="count(preceding-sibling::x:div[@id])+1"/>
   <xsl:variable name="ld" select="$la/x:div[@class='a'][position()=$n]"/>
-  <xsl:message><xsl:value-of select="@id"/>,<xsl:value-of select="$n"/>,<xsl:value-of select="x:h4"/>,<xsl:value-of select="count(x:p)"/>,<xsl:value-of select="$ld/x:h3"/>,<xsl:value-of select="count($ld/x:p)"/></xsl:message>
+  <xsl:variable name="lp" select="$ld/*[self::x:p or self::x:div]"/>
+  <xsl:message><xsl:value-of select="@id"/>,<xsl:value-of select="$n"/>,<xsl:value-of select="x:h4"/>,<xsl:value-of select="count(x:p)"/>,<xsl:value-of select="$ld/x:h3"/>,<xsl:value-of select="count($lp)"/></xsl:message>
   <xsl:choose>
-   <xsl:when test="count(x:p)=count($ld/x:p)">
+   <xsl:when test="count(x:p)=count($lp)">
     <xsl:copy>
      <xsl:apply-templates select="@*|x:h4"/>
      <xsl:for-each select="x:p">
       <xsl:variable name="i" select="position()"/>
       <xsl:call-template name="doBi">
        <xsl:with-param select="." name="english"/>
-       <xsl:with-param select="$ld/x:p[position()=$i]" name="latin"/>
+       <xsl:with-param select="$lp[position()=$i]" name="latin"/>
       </xsl:call-template>
      </xsl:for-each>
     </xsl:copy>
    </xsl:when>
    <xsl:otherwise>
-    <xsl:message>Can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="count(x:p)"/>!=<xsl:value-of select="count($ld/x:p)"/></xsl:message>
+    <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>
     <!-- Try to split on keywords in English -->
     <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 ')])"/>
     <xsl:choose>
-     <xsl:when test="$pb=count($ld/x:p)">
+     <xsl:when test="$pb=count($lp)">
       <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 ')]]">
        <xsl:variable name="i" select="position()"/>
        <xsl:call-template name="doBi">
         <xsl:with-param select="current-group()" name="english"/>
-        <xsl:with-param select="$ld/x:p[position()=$i]" name="latin"/>
+        <xsl:with-param select="$lp[position()=$i]" name="latin"/>
       </xsl:call-template>
       </xsl:for-each-group>
      </xsl:when>
      <xsl:otherwise>
-      <xsl:message>Still can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="$pb"/>!=<xsl:value-of select="count($ld/x:p)"/></xsl:message>
+      <xsl:message>Still can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="$pb"/>!=<xsl:value-of select="count($lp)"/></xsl:message>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:otherwise>