changeset 43:d49f2ca9374c

all but proemium working
author ht
date Thu, 17 Dec 2009 09:55:34 +0000
parents 8f4be7dfda7a
children d16e7ecf99ad
files summa/bilingual/merge.xsl
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/summa/bilingual/merge.xsl	Wed Dec 16 23:11:44 2009 +0000
+++ b/summa/bilingual/merge.xsl	Thu Dec 17 09:55:34 2009 +0000
@@ -22,5 +22,27 @@
   <xsl:variable name="n" select="count(preceding-sibling::x:div[@n])+1"/>
   <xsl:variable name="ld" select="$la/x:div[@class='a'][position()=$n]"/>
   <xsl:message><xsl:value-of select="@n"/>,<xsl:value-of select="$n"/>,<xsl:value-of select="@title"/>,<xsl:value-of select="count(x:div)"/>,<xsl:value-of select="$ld/x:h3"/>,<xsl:value-of select="count($ld/x:p)"/></xsl:message>
+  <xsl:choose>
+   <xsl:when test="count(x:div)=count($ld/x:p)">
+    <xsl:copy>
+     <xsl:apply-templates select="@*|x:h4"/>
+     <xsl:for-each select="x:div">
+      <xsl:variable name="i" select="position()"/>
+      <xsl:copy>
+         <xsl:apply-templates select="@*|x:div[1]"/>
+         <xsl:for-each select="x:div[2]">
+          <xsl:copy>
+           <xsl:apply-templates select="@*"/>
+           <xsl:apply-templates select="$ld/x:p[position()=$i]"/>
+          </xsl:copy>
+         </xsl:for-each>
+        </xsl:copy>
+     </xsl:for-each>
+    </xsl:copy>
+   </xsl:when>
+   <xsl:otherwise>
+    <xsl:message>Can't merge article <xsl:value-of select="@n"/>, <xsl:value-of select="count(x:div)"/>!=<xsl:value-of select="count($ld/x:p)"/></xsl:message>
+   </xsl:otherwise>
+  </xsl:choose>  
  </xsl:template>
 </xsl:stylesheet>