This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook-apps] mediaobjectco not aligned - bug in fo/graphics.xsl?


Recently I've discovered some problem when I try to use the align attribute for imagedata elements that are embedded within mediaobjectco/imageobjectco.

The align attribute will be ignored for those objects.

        <mediaobjectco>
          <imageobjectco>
            <imageobject>
              <imagedata align="center"
                         fileref="../resources/svg/screenshots/screen-web.svg"
                         format="SVG" />
            </imageobject>
          </imageobjectco>
        </mediaobjectco>

The fo/graphics.xsl stylesheet expected an imagadata element as child of imageobjectco. But imageobjectco can't have imagedata as child. It has to be wrapped by imageobject. Thats why the stylesheet can't find an align attribute.

To fix this, I've changed the template mediaobject|mediaobjectco ...

from:

  <xsl:variable name="align">
    <xsl:value-of select="$object/imagedata[@align][1]/@align"/>
  </xsl:variable>

to:

  <xsl:variable name="align">
    <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
  </xsl:variable>


This leads to another problem when callout lists used within imageobjectco. Because the callouts now have the same alignment as imagedata. That's why I've additionally changed the calloutlist template and added an attribute text-align="left" to the fo:block element.


<xsl:template match="calloutlist">
  <xsl:variable name="id">
  <xsl:call-template name="object.id"/>
  </xsl:variable>
  <fo:block id="{$id}" text-align="left">
    <xsl:if test="title">
      <xsl:apply-templates select="title" mode="list.title.mode"/>
    </xsl:if>
    <!-- Preserve order of PIs and comments -->
    <xsl:apply-templates
         select="*[not(self::callout or self::title or self::titleabbrev)]
                   |comment()[not(preceding-sibling::callout)]
                   |processing-instruction()[not(preceding-sibling::callout)]"/>
    <fo:list-block space-before.optimum="1em"
                   space-before.minimum="0.8em"
                   space-before.maximum="1.2em"
                   provisional-distance-between-starts="2.2em"
                   provisional-label-separation="0.2em">
      <xsl:apply-templates select="callout
                                |comment()[preceding-sibling::calllout]
                                |processing-instruction()[preceding-sibling::callout]"/>
    </fo:list-block>
  </fo:block>
</xsl:template>


Regards, Alexander Karnstedt


--------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]