From: <ba...@us...> - 2008-04-03 06:58:42
|
Revision: 7978 http://docbook.svn.sourceforge.net/docbook/?rev=7978&view=rev Author: balls Date: 2008-04-02 23:58:34 -0700 (Wed, 02 Apr 2008) Log Message: ----------- fix table/cell borders for wordml, fix formal figure, add emphasis-strong Modified Paths: -------------- trunk/xsl/roundtrip/blocks2dbk.xsl trunk/xsl/roundtrip/wordml2normalise.xsl Modified: trunk/xsl/roundtrip/blocks2dbk.xsl =================================================================== --- trunk/xsl/roundtrip/blocks2dbk.xsl 2008-04-02 07:57:23 UTC (rev 7977) +++ trunk/xsl/roundtrip/blocks2dbk.xsl 2008-04-03 06:58:34 UTC (rev 7978) @@ -69,7 +69,7 @@ <xsl:variable name='figure' select='preceding-sibling::dbk:para[dbk:inlinemediaobject and count(*) = 1 and normalize-space(.) = ""][1]'/> <xsl:variable name='caption' - select='following-sibling::dbk:para[@rnd:style = "caption"]'/> + select='following-sibling::dbk:para[@rnd:style = "caption" or @rnd:style = "Caption"]'/> <xsl:choose> <!-- continue style paragraphs are handled in context --> @@ -94,7 +94,7 @@ @rnd:style = "figure-title" and following-sibling::*[1][self::dbk:para][dbk:inlinemediaobject and count(*) = 1 and normalize-space(.) = ""]'/> <xsl:when test='$suppress and - @rnd:style = "caption" and + (@rnd:style = "caption" or @rnd:style = "Caption") and (preceding-sibling::*[self::dbk:informaltable] or preceding-sibling::*[self::dbk:para][dbk:inlinemediaobject and count(*) = 1 and normalize-space(.) = ""])'/> @@ -382,21 +382,42 @@ </xsl:when> <xsl:when test='@rnd:style = "informalfigure-imagedata"'> - <dbk:informalfigure> - <xsl:call-template name='rnd:attributes'/> - <dbk:mediaobject> - <dbk:imageobject> - <dbk:imagedata fileref='{.}'/> - </dbk:imageobject> - </dbk:mediaobject> - <xsl:apply-templates select='following-sibling::*[1][self::dbk:para][@rnd:style = "caption"]' - mode='rnd:caption'/> - </dbk:informalfigure> + <xsl:choose> + <xsl:when test='preceding-sibling::*[1][self::dbk:para][@rnd:style = "figure-title"]'> + <dbk:figure> + <xsl:call-template name='rnd:attributes'/> + <dbk:info> + <dbk:title> + <xsl:apply-templates select='preceding-sibling::*[1]/node()'/> + </dbk:title> + </dbk:info> + <dbk:mediaobject> + <dbk:imageobject> + <dbk:imagedata fileref='{.}'/> + </dbk:imageobject> + </dbk:mediaobject> + <xsl:apply-templates select='following-sibling::*[1][self::dbk:para][@rnd:style = "caption" or @rnd:style = "Caption"]' + mode='rnd:caption'/> + </dbk:figure> + </xsl:when> + <xsl:otherwise> + <dbk:informalfigure> + <xsl:call-template name='rnd:attributes'/> + <dbk:mediaobject> + <dbk:imageobject> + <dbk:imagedata fileref='{.}'/> + </dbk:imageobject> + </dbk:mediaobject> + <xsl:apply-templates select='following-sibling::*[1][self::dbk:para][@rnd:style = "caption" or @rnd:style = "Caption"]' + mode='rnd:caption'/> + </dbk:informalfigure> + </xsl:otherwise> + </xsl:choose> </xsl:when> - <xsl:when test='@rnd:style = "caption" and + <xsl:when test='(@rnd:style = "caption" or @rnd:style = "Caption") and preceding-sibling::*[(self::dbk:para and contains(@rnd:style, "imagedata")) or self::dbk:informaltable]'/> - <xsl:when test='@rnd:style = "caption"'> + <xsl:when test='@rnd:style = "caption" or @rnd:style = "Caption"'> <xsl:call-template name='rnd:error'> <xsl:with-param name='code'>bad-caption</xsl:with-param> <xsl:with-param name='message'>caption does not follow table or figure</xsl:with-param> @@ -444,7 +465,7 @@ </xsl:copy> </xsl:when> - <xsl:when test='@rnd:style = preceding-sibling::node()[self::dbk:emphasis]/@rnd:style'/> + <xsl:when test='@rnd:style = preceding-sibling::node()[1][self::dbk:emphasis]/@rnd:style'/> <xsl:when test='@rnd:style = "emphasis"'> <xsl:copy> @@ -452,7 +473,8 @@ <xsl:apply-templates mode='rnd:copy'/> </xsl:copy> </xsl:when> - <xsl:when test='@rnd:style = "emphasis-bold"'> + <xsl:when test='@rnd:style = "emphasis-bold" or + @rnd:style = "emphasis-strong"'> <xsl:copy> <xsl:attribute name='role'>bold</xsl:attribute> <xsl:call-template name='rnd:attributes'/> @@ -530,7 +552,7 @@ select='ancestor::dbk:para/following-sibling::*[self::dbk:informaltable or self::dbk:para[dbk:inlinemediaobject and count(*) = 1 and normalize-space() = ""]][1]'/> <xsl:variable name='caption' - select='ancestor::dbk:para/following-sibling::dbk:para[@rnd:style = "caption"]'/> + select='ancestor::dbk:para/following-sibling::dbk:para[@rnd:style = "caption" or @rnd:style = "Caption"]'/> <xsl:variable name='metadata'> <xsl:apply-templates select='ancestor::dbk:para/following-sibling::*[1]' @@ -581,7 +603,8 @@ </xsl:choose> </xsl:template> - <xsl:template match='dbk:para[@rnd:style = "caption"]' mode='rnd:caption'> + <xsl:template match='dbk:para[@rnd:style = "caption" or @rnd:style = "Caption"]' + mode='rnd:caption'> <dbk:caption> <dbk:para> <xsl:apply-templates/> @@ -1197,7 +1220,7 @@ <!-- Find the caption associated with this table --> <xsl:template name='rnd:table-caption'> <xsl:variable name='candidate' - select='following-sibling::dbk:para[@rnd:style = "caption"][1]'/> + select='following-sibling::dbk:para[@rnd:style = "caption" or @rnd:style = "Caption"][1]'/> <xsl:if test='$candidate != "" and generate-id($candidate/preceding-sibling::dbk:informaltable[1]) = generate-id(.)'> @@ -1212,7 +1235,7 @@ <!-- Find table associated text --> <xsl:template name='rnd:table-textobject'> <xsl:variable name='caption' - select='following-sibling::dbk:para[@rnd:style = "caption"][1]'/> + select='following-sibling::dbk:para[@rnd:style = "caption" or @rnd:style = "Caption"][1]'/> <xsl:if test='generate-id($caption/preceding-sibling::dbk:informaltable[1]) = generate-id(.)'> <xsl:variable name='content' Modified: trunk/xsl/roundtrip/wordml2normalise.xsl =================================================================== --- trunk/xsl/roundtrip/wordml2normalise.xsl 2008-04-02 07:57:23 UTC (rev 7977) +++ trunk/xsl/roundtrip/wordml2normalise.xsl 2008-04-03 06:58:34 UTC (rev 7978) @@ -216,43 +216,38 @@ </xsl:template> <xsl:template match='w:tbl'> + <xsl:variable name='tbl.style' + select='key("style", w:tblPr/w:tblStyle/@w:val) | .'/> + <xsl:variable name='border.top'> <xsl:choose> - <xsl:when test='w:tblPr/w:tblBorders/w:top[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblBorders/w:top[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:top[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:top[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> <xsl:when test='w:tr[1]/w:tc[w:tcPr/w:tcBorders/w:top[not(@w:val = "nil" or @w:val = "none")]]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblStyle and - key("style", w:tblPr/w:tblStyle/@w:val)/w:tblPr/w:tblBorders/w:top'>1</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name='border.bottom'> <xsl:choose> - <xsl:when test='w:tblPr/w:tblBorders/w:bottom[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblBorders/w:bottom[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:bottom[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:bottom[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> <xsl:when test='w:tr[1]/w:tc[w:tcPr/w:tcBorders/w:bottom[not(@w:val = "nil" or @w:val = "none")]]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblStyle and - key("style", w:tblPr/w:tblStyle/@w:val)/w:tblPr/w:tblBorders/w:bottom'>1</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name='border.left'> <xsl:choose> - <xsl:when test='w:tblPr/w:tblBorders/w:left[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblBorders/w:left[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:left[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:left[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> <xsl:when test='w:tr[1]/w:tc[w:tcPr/w:tcBorders/w:left[not(@w:val = "nil" or @w:val = "none")]]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblStyle and - key("style", w:tblPr/w:tblStyle/@w:val)/w:tblPr/w:tblBorders/w:left'>1</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name='border.right'> <xsl:choose> - <xsl:when test='w:tblPr/w:tblBorders/w:right[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblBorders/w:right[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:right[not(@w:val = "nil" or @w:val = "none")]'>1</xsl:when> + <xsl:when test='$tbl.style/w:tblPr/w:tblBorders/w:right[@w:val = "nil" or @w:val = "none"]'>0</xsl:when> <xsl:when test='w:tr[1]/w:tc[w:tcPr/w:tcBorders/w:rightt[not(@w:val = "nil" or @w:val = "none")]]'>1</xsl:when> - <xsl:when test='w:tblPr/w:tblStyle and - key("style", w:tblPr/w:tblStyle/@w:val)/w:tblPr/w:tblBorders/w:rightt'>1</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> @@ -298,12 +293,16 @@ </dbk:row> </xsl:template> <xsl:template match='w:tc'> + <xsl:variable name='tbl.style' + select='ancestor::w:tbl[1] | + key("style", ancestor::w:tbl[1]/w:tblPr/w:tblStyle/@w:val)'/> + <dbk:entry> - <xsl:if test='ancestor::w:tbl[1]/w:tblPr/w:tblBorders/w:insideH[not(@w:val = "nil" or @w:val = "none")] | + <xsl:if test='$tbl.style/w:tblPr/w:tblBorders/w:insideH[not(@w:val = "nil" or @w:val = "none")] | w:tcPr/w:tcBorders/w:bottom[not(@w:val = "nil" or @w:val = "none")]'> <xsl:attribute name='rowsep'>1</xsl:attribute> </xsl:if> - <xsl:if test='ancestor::w:tbl[1]/w:tblPr/w:tblBorders/w:insideV[not(@w:val = "nil" or @w:val = "none")] | + <xsl:if test='$tbl.style/w:tblPr/w:tblBorders/w:insideV[not(@w:val = "nil" or @w:val = "none")] | w:tcPr/w:tcBorders/w:right[not(@w:val = "nil" or @w:val = "none")]'> <xsl:attribute name='colsep'>1</xsl:attribute> </xsl:if> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |