title: Have caption run only as wide as the table on centered table
body: <p>I'm using XSL-FO with Antennahouse FO formatter.</p>
  <p>How do I make the <code>fo:caption</code> in a <code>fo:table-and-caption</code> element run only as wide as the <code>fo:table</code> does?</p>
  <p>Essentially, I am looking for the FO equivalent of this HTML:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;head&gt;
      &lt;title&gt;Image with Caption – CENTERED&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt; 
      &lt;div style=&quot;border:2px solid blue;&quot;&gt;
        &lt;table style=&quot;border:1px solid green; margin-left:auto; margin-right:auto;&quot;&gt;
          &lt;caption style=&quot;caption-side:bottom; text-align:left; border:1px solid red;&quot;&gt;&lt;p style=&quot;font-size:9pt;&quot;&gt;Sourceline (left edge should match up with table's left edge, and line breaking should occur at right edge of table)&lt;/p&gt;&lt;/caption&gt;
          &lt;tr&gt;
            &lt;td&gt;&lt;p&gt;&amp;lt;- The table runs only this wide. -&gt;&lt;/p&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;
      &lt;/div&gt;
      &lt;p&gt;BLUE = wrapper-DIV&lt;/p&gt;
      &lt;p&gt;GREEN = table&lt;/p&gt;
      &lt;p&gt;RED = caption&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>which looks like this: <img src="https://i.stack.imgur.com/MIYXt.png" alt="HTML rendering of above code" /></p>
  <p>The XSL-FO code I have is this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;fo:root xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot;&gt;
    &lt;fo:layout-master-set&gt;
      &lt;fo:simple-page-master margin-bottom=&quot;58px&quot; margin-left=&quot;120px&quot; margin-right=&quot;120px&quot; margin-top=&quot;50px&quot; master-name=&quot;content-page&quot; page-height=&quot;11in&quot; page-width=&quot;8.5in&quot;&gt;
        &lt;fo:region-body margin-bottom=&quot;44px&quot; margin-top=&quot;50px&quot; region-name=&quot;xsl-region-body&quot; /&gt;
      &lt;/fo:simple-page-master&gt;
    &lt;/fo:layout-master-set&gt;
    &lt;fo:page-sequence master-reference=&quot;content-page&quot;&gt;
      &lt;fo:flow flow-name=&quot;xsl-region-body&quot;&gt;
  
        &lt;fo:block&gt;
          &lt;fo:table-and-caption border=&quot;2px solid blue&quot; text-align=&quot;center&quot;&gt;
          &lt;fo:table-caption border=&quot;1px solid red&quot; caption-side=&quot;bottom&quot;&gt;
            &lt;fo:block font-size=&quot;8pt&quot; text-align=&quot;left&quot;&gt;Sourceline (left edge should match up with table's left edge, and line breaking should occur at right edge of table)&lt;/fo:block&gt;
          &lt;/fo:table-caption&gt;
          &lt;fo:table border=&quot;1px solid green&quot;&gt;
            &lt;fo:table-column/&gt;
            &lt;fo:table-body&gt;
              &lt;fo:table-row&gt;
                &lt;fo:table-cell&gt;
                  &lt;fo:block&gt;&amp;lt;- The table runs only this wide. -&gt;&lt;/fo:block&gt;
                &lt;/fo:table-cell&gt;
              &lt;/fo:table-row&gt;
            &lt;/fo:table-body&gt;
          &lt;/fo:table&gt;
          &lt;/fo:table-and-caption&gt;
        &lt;/fo:block&gt;
  
        &lt;fo:block&gt;BLUE = fo:table-and-caption&lt;/fo:block&gt;
        &lt;fo:block&gt;GREEN = fo:table&lt;/fo:block&gt;
        &lt;fo:block&gt;RED = fo:caption&lt;/fo:block&gt;
  
      &lt;/fo:flow&gt;
    &lt;/fo:page-sequence&gt;
  &lt;/fo:root&gt;
  </code></pre>
  <p>which renders like this: <img src="https://i.stack.imgur.com/sk8Jn.png" alt="PDF rendering of above code" /></p>
  <p>How do I force (in XSL-FO) the table caption to only run as wide as the table (which might be arbitrarily complex, including e.g. <code>fo:table-footer</code> and table borders on table or cells), and start at the left edge of its associated table (like in the HTML rendering)?</p>