From: <ba...@us...> - 2007-11-06 12:32:42
|
Revision: 7553 http://docbook.svn.sourceforge.net/docbook/?rev=7553&view=rev Author: balls Date: 2007-11-06 04:32:39 -0800 (Tue, 06 Nov 2007) Log Message: ----------- fix caption, attributes Modified Paths: -------------- trunk/xsl/roundtrip/blocks2dbk.xsl trunk/xsl/roundtrip/dbk2wp.xsl trunk/xsl/roundtrip/normalise-common.xsl trunk/xsl/roundtrip/wordml2normalise.xsl Modified: trunk/xsl/roundtrip/blocks2dbk.xsl =================================================================== --- trunk/xsl/roundtrip/blocks2dbk.xsl 2007-11-06 00:10:06 UTC (rev 7552) +++ trunk/xsl/roundtrip/blocks2dbk.xsl 2007-11-06 12:32:39 UTC (rev 7553) @@ -124,6 +124,7 @@ @rnd:style = "" or @rnd:style = "para-continue"'> <dbk:para> + <xsl:call-template name='rnd:attributes'/> <xsl:apply-templates/> </dbk:para> </xsl:when> @@ -142,6 +143,7 @@ <xsl:when test='&admonition-title;'> <xsl:element name='{substring-before(@rnd:style, "-title")}' namespace='http://docbook.org/ns/docbook'> + <xsl:call-template name='rnd:attributes'/> <dbk:title> <xsl:apply-templates/> </dbk:title> @@ -223,6 +225,7 @@ <xsl:when test='@rnd:style = "example-title"'> <xsl:element name='{substring-before(@rnd:style, "-title")}' namespace='http://docbook.org/ns/docbook'> + <xsl:call-template name='rnd:attributes'/> <dbk:title> <xsl:apply-templates/> </dbk:title> @@ -239,6 +242,7 @@ normalize-space(.) = ""][1]'/> <dbk:sidebar> + <xsl:call-template name='rnd:attributes'/> <dbk:info> <dbk:title> <xsl:apply-templates/> @@ -261,6 +265,7 @@ <xsl:when test='&admonition;'> <xsl:element name='{@rnd:style}' namespace='http://docbook.org/ns/docbook'> + <xsl:call-template name='rnd:attributes'/> <dbk:para> <xsl:apply-templates/> </dbk:para> @@ -274,11 +279,13 @@ --> <xsl:when test='@rnd:style = "bibliomixed"'> <dbk:bibliomixed> + <xsl:call-template name='rnd:attributes'/> <xsl:apply-templates/> </dbk:bibliomixed> </xsl:when> <xsl:when test='@rnd:style = "biblioentry-title"'> <dbk:biblioentry> + <xsl:call-template name='rnd:attributes'/> <dbk:title> <xsl:apply-templates/> </dbk:title> @@ -309,6 +316,7 @@ @rnd:style = "blockquote-attribution")][1]'/> <dbk:blockquote> + <xsl:call-template name='rnd:attributes'/> <xsl:if test='@rnd:style = "blockquote-title"'> <dbk:info> <dbk:title> @@ -373,14 +381,26 @@ <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:when> + <xsl:when test='@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: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> + </xsl:call-template> + </xsl:when> + <xsl:when test='(contains(@rnd:style, "-title") or contains(@rnd:style, "-titleabbrev") or contains(@rnd:style, "-subtitle")) and @@ -401,6 +421,13 @@ </xsl:choose> </xsl:template> + <xsl:template match='dbk:para' mode='rnd:caption'> + <dbk:caption> + <xsl:call-template name='rnd:attributes'/> + <xsl:apply-templates/> + </dbk:caption> + </xsl:template> + <xsl:template match='dbk:emphasis'> <xsl:choose> <xsl:when test='not(@rnd:style) and @role = "italic"'> Modified: trunk/xsl/roundtrip/dbk2wp.xsl =================================================================== --- trunk/xsl/roundtrip/dbk2wp.xsl 2007-11-06 00:10:06 UTC (rev 7552) +++ trunk/xsl/roundtrip/dbk2wp.xsl 2007-11-06 12:32:39 UTC (rev 7553) @@ -375,6 +375,7 @@ <xsl:with-param name='style' select='"informalfigure-imagedata"'/> <xsl:with-param name='content'> <xsl:call-template name='doc:make-phrase'> + <xsl:with-param name='style'/> <xsl:with-param name='content'> <xsl:apply-templates select='mediaobject/imageobject/imagedata/@fileref | doc:mediaobject/doc:imageobject/doc:imagedata/@fileref' @@ -698,7 +699,9 @@ <xsl:when test='not(para|doc:para)'> <!-- TODO: check for any block elements --> <xsl:call-template name='doc:make-paragraph'> + <xsl:with-param name='style'/> <xsl:with-param name='attributes.node' select='/..'/> + <xsl:with-param name='content'/> </xsl:call-template> </xsl:when> <xsl:otherwise> Modified: trunk/xsl/roundtrip/normalise-common.xsl =================================================================== --- trunk/xsl/roundtrip/normalise-common.xsl 2007-11-06 00:10:06 UTC (rev 7552) +++ trunk/xsl/roundtrip/normalise-common.xsl 2007-11-06 12:32:39 UTC (rev 7553) @@ -20,7 +20,12 @@ The idea is to map custom names back to standard names. --> <xsl:template name='rnd:map-paragraph-style'> <xsl:param name='style'/> - <xsl:value-of select='$style'/> + <xsl:choose> + <xsl:when test='starts-with($style, "Normal")'/> + <xsl:otherwise> + <xsl:value-of select='$style'/> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template name='rnd:map-character-style'> <xsl:param name='style'/> Modified: trunk/xsl/roundtrip/wordml2normalise.xsl =================================================================== --- trunk/xsl/roundtrip/wordml2normalise.xsl 2007-11-06 00:10:06 UTC (rev 7552) +++ trunk/xsl/roundtrip/wordml2normalise.xsl 2007-11-06 12:32:39 UTC (rev 7553) @@ -61,10 +61,24 @@ <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:apply-templates/> </dbk:para> </xsl:template> + <xsl:template match='*' mode='rnd:attributes'> + <xsl:attribute name='{w:t}'> + <xsl:apply-templates select='following-sibling::w:r[w:rPr/w:rStyle/@w:val = "attribute-value"][1]' + mode='rnd:attribute-value'/> + </xsl:attribute> + </xsl:template> + <xsl:template match='w:r'> <xsl:param name='do-vert-align' select='true()'/> @@ -93,6 +107,8 @@ </xsl:variable> <xsl:choose> + <xsl:when test='w:rPr/w:rStyle/@w:val = "attributes"'/> + <xsl:when test='w:rPr/w:rStyle/@w:val = "CommentReference"'/> <xsl:when test='w:pict'> <xsl:variable name='filename'> <xsl:choose> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |