</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'/>
<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>