]> granicus.if.org Git - docbook-dsssl/commitdiff
fixed tables in list items
authorSteve Ball <balls@users.sourceforge.net>
Wed, 2 Jul 2008 13:22:36 +0000 (13:22 +0000)
committerSteve Ball <balls@users.sourceforge.net>
Wed, 2 Jul 2008 13:22:36 +0000 (13:22 +0000)
handle Word track changes

xsl/roundtrip/blocks2dbk.xsl
xsl/roundtrip/wordml2normalise.xsl

index abd972f18fc867d6f8657668810b1f3a529149db..3a62eff2f8253329702c39282067dacb8ecef8c2 100644 (file)
           </xsl:when>
 
           <!-- TODO: the previous para-continue may not be associated with a list -->
-          <xsl:when test='preceding-sibling::*[1][self::dbk:para][starts-with(@rnd:style, "itemizedlist") or starts-with(@rnd:style, "orderedlist") or @rnd:style = "para-continue"]'/>
+
+          <!-- NB. Look back at the previous paragraph. There may be intervening tables or images. -->
+          <xsl:when test='preceding-sibling::dbk:para[1][starts-with(@rnd:style, "itemizedlist") or starts-with(@rnd:style, "orderedlist") or @rnd:style = "para-continue"]'/>
           <xsl:when test='substring-after(@rnd:style, "list") != 1'>
             <xsl:call-template name='rnd:error'>
               <xsl:with-param name='code'>list-wrong-level</xsl:with-param>
       </xsl:when>
 
       <xsl:when test='@rnd:style = "sidebar-title"'>
+        <!-- TODO: next sidebar should stop this sidebar -->
        <xsl:variable name='stop.node'
                      select='following-sibling::dbk:para[(not(@rnd:style) or @rnd:style = "") and
                              normalize-space(.) = ""][1]'/>
         mode='rnd:continue'/>
     </xsl:if>
   </xsl:template>
+  <xsl:template match='dbk:informaltable' mode='rnd:continue'>
+    <xsl:apply-templates select='.'>
+      <xsl:with-param name='in-list' select='true()'/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select='following-sibling::*[1]'
+      mode='rnd:continue'/>
+  </xsl:template>
 
   <!-- Tables -->
 
   <xsl:template match='dbk:informaltable'>
+    <xsl:param name='in-list' select='false()'/>
+
     <xsl:choose>
+      <xsl:when test='not($in-list) and
+                      preceding-sibling::dbk:para[1][starts-with(@rnd:style, "itemizedlist") or starts-with(@rnd:style, "orderedlist") or @rnd:style = "para-continue"]'/>
       <xsl:when test='preceding-sibling::*[1][self::dbk:para][@rnd:style ="table-title"]'>
        <dbk:table>
          <xsl:apply-templates select='@*' mode='rnd:copy'/>
index b0581cefa5681f983354527e7b17d6118cc823ba..a6acca80e909e87dfa59b098f51b74f2008c9c9d 100644 (file)
         <xsl:with-param name='style' select='w:pPr/w:pStyle/@w:val'/>
       </xsl:call-template>
     </xsl:variable>
-    <dbk:para>
-      <xsl:attribute name='rnd:style'>
-        <xsl:value-of select='$style'/>
-      </xsl:attribute>
-      <xsl:if test='w:pPr/w:pStyle/@w:val and
-                    $style != w:pPr/w:pStyle/@w:val'>
-        <xsl:attribute name='rnd:original-style'>
-          <xsl:value-of select='w:pPr/w:pStyle/@w:val'/>
-        </xsl:attribute>
-      </xsl:if>
+    <xsl:choose>
+      <xsl:when test='aml:annotation[@w:type = "Word.Deletion"] and
+                      not(aml:annotation[@w:type != "Word.Deletion"]) and
+                      count(*) = count(aml:annotation|w:pPr)'/>
+      <xsl:otherwise>
+        <dbk:para>
+          <xsl:attribute name='rnd:style'>
+            <xsl:value-of select='$style'/>
+          </xsl:attribute>
+          <xsl:if test='w:pPr/w:pStyle/@w:val and
+                        $style != w:pPr/w:pStyle/@w:val'>
+            <xsl:attribute name='rnd:original-style'>
+              <xsl:value-of select='w:pPr/w:pStyle/@w:val'/>
+            </xsl:attribute>
+          </xsl:if>
 
-      <xsl:if test='w:r[1][w:rPr/w:rStyle/@w:val = "attributes"] and
-                    w:r[2][w:rPr/w:rStyle/@w:val = "CommentReference"]'>
-        <xsl:apply-templates select='w:r[2]//w:r[w:rPr/w:rStyle/@w:val = "attribute-name"]'
-          mode='rnd:attributes'/>
-      </xsl:if>
+          <xsl:if test='w:r[1][w:rPr/w:rStyle/@w:val = "attributes"] and
+                        w:r[2][w:rPr/w:rStyle/@w:val = "CommentReference"]'>
+            <xsl:apply-templates select='w:r[2]//w:r[w:rPr/w:rStyle/@w:val = "attribute-name"]'
+              mode='rnd:attributes'/>
+          </xsl:if>
 
-      <xsl:apply-templates/>
-    </dbk:para>
+          <xsl:apply-templates/>
+        </dbk:para>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
   <xsl:template match='*' mode='rnd:attributes'>
 
   <xsl:template match='w:hdr|w:ftr'/>
 
+  <xsl:template match='aml:annotation'>
+    <xsl:choose>
+      <xsl:when test='@w:type = "Word.Deletion"'/>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
 </xsl:stylesheet>