title: XSL-FO: Adjust border-width based on text width
body: <p>I am having trouble with XSL-FO using Apache FOP as a processor. I have a simple stylesheet and already have set a round border to an fo:block-container. The problem is: the text size is non-predictable given that the .fo file will be generated using a XSLT and a XML, so i need to tell FOP to adjust the border width according to the text width instead of  applying the same width to all of the containers. Any ideas?</p>
  
  <blockquote>
    <p>In XSLT file: </p>
  </blockquote>
  
  <pre><code>    &lt;fo:block-container xsl:use-attribute-sets="right-side-itens"&gt;
          &lt;fo:block-container xsl:use-attribute-sets="rounded-borders"&gt;                                    
              &lt;fo:block&gt;
                  &lt;xsl:value-of-select="./tagInsideXML/@attribute" /&gt;
                  &lt;!-- qwertyuiopasdfghjkl --&gt;
              &lt;/fo:block&gt;
          &lt;/fo:block-container&gt;
      &lt;fo:block-container&gt;
  </code></pre>
  
  <p>`</p>
  
  <blockquote>
    <p>In the styles.xsl external file:  </p>
  </blockquote>
  
  <pre><code>&lt;xsl:attribute-set name="right-side-itens"&gt;
      &lt;xsl:attribute name="top"&gt;35px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="right"&gt;45px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="text-align"&gt;end&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="font-size"&gt;10px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="height"&gt;10cm&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="width"&gt;200px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="position"&gt;absolute&lt;/xsl:attribute&gt;
  &lt;/xsl:attribute-set&gt;
  
  &lt;xsl:attribute-set name="rounded-borders"&gt;
      &lt;xsl:attribute name="margin-top"&gt;2px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="margin-right"&gt;1.8px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="padding-right"&gt;2px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="float"&gt;right&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="line-height"&gt;18px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="font-size"&gt;8px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="border"&gt;solid 1.2px #000000&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="fox:border-radius"&gt;6px&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="position"&gt;relative&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="overflow"&gt;visible&lt;/xsl:attribute&gt;
  &lt;/xsl:attribute-set&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/UjSCJ.png" rel="nofollow noreferrer">Here is a sample image showing the desired output</a></p>