]> granicus.if.org Git - docbook-dsssl/commitdiff
fix caption, attributes
authorSteve Ball <balls@users.sourceforge.net>
Tue, 6 Nov 2007 12:32:39 +0000 (12:32 +0000)
committerSteve Ball <balls@users.sourceforge.net>
Tue, 6 Nov 2007 12:32:39 +0000 (12:32 +0000)
xsl/roundtrip/blocks2dbk.xsl
xsl/roundtrip/dbk2wp.xsl
xsl/roundtrip/normalise-common.xsl
xsl/roundtrip/wordml2normalise.xsl

index ac2745389bac105fecb125536e5e5540f4050988..0936a0ee7c2d26b68867818e00da5764c9672fa3 100644 (file)
                       @rnd:style = "" or
                       @rnd:style = "para-continue"'>
         <dbk:para>
+          <xsl:call-template name='rnd:attributes'/>
           <xsl:apply-templates/>
         </dbk:para>
       </xsl:when>
       <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>
       <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>
                              normalize-space(.) = ""][1]'/>
 
        <dbk:sidebar>
+          <xsl:call-template name='rnd:attributes'/>
          <dbk:info>
            <dbk:title>
              <xsl:apply-templates/>
       <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>
        -->
       <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>
                       @rnd:style = "blockquote-attribution")][1]'/>
 
             <dbk:blockquote>
+              <xsl:call-template name='rnd:attributes'/>
              <xsl:if test='@rnd:style = "blockquote-title"'>
                <dbk:info>
                  <dbk:title>
 
       <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
     </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"'>
index 22e59b7d29f8cbdae0e446bc6c26f295576694ad..e8b333df94909b4f26ab81df96d90e4931fdca0f 100644 (file)
        <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'
           <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>
index f67e40ca273858ed895d2c25aef6eb60fed03871..a58989a315900be6637b23537839f1a3193ec06d 100644 (file)
        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'/>
index 0cb292b219e76581f9ec12bcf5fdb6af3a26f666..d5da84b5af0aa4eb57c085149d9e6416d8c7225f 100644 (file)
           <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()'/>
 
     </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>