xsl-list
[Top] [All Lists]

[xsl] Displaying Icon in Page Margin

2011-09-14 17:07:58
I've been banging my head against a problem for most of the day and
Eliot Kimber suggested I bring it here. I have a specialized element
wrapper in DITA that can be applied to just about any phrase (list
item, table entry, para, etc.) I'm rendering to PDF via FO (XEP) and
what I'd like to do is draw a small icon approximately 20px from the
margin of the page wherever this element is used. If it's found inside
a table cell, for example, I'd like the icon to draw to the left of
the table inline with the cell where it's found.
I've tried two methods, neither of which is doing what I need. The
first looks like:

<fo:block-container absolute-position="fixed" left="20px">
  <fo:block >
    <fo:external-graphic src="url({concat($artworkPrefix, $noteImagePath)})" />
  </fo:block>
</fo:block-container>

This works for locating the graphic along the left margin, but , but
unfortunately the graphic  is displayed at the top of the page and I
haven't been able to figure out a way to find the vertical position of
the element to be able to set a "top" attribute correctly.
The other method which seems more promising is to use floats like so:

<xsl:template match="limit">
...
        <xsl:if test="@origin='fdx'">
            <fo:float float="start" >
            <fo:block-container>
                <fo:block >
                <fo:external-graphic
                    src="url({concat($artworkPrefix, $noteImagePath)})"
                    xsl:use-attribute-sets="image"/>

            </fo:block>
            </fo:block-container>
            </fo:float>
        </xsl:if>

        <fo:inline>
            <xsl:if test="@memoryitem='yes'">
                <xsl:attribute name="text-decoration">underline</xsl:attribute>
            </xsl:if>
            <xsl:apply-templates/>
        </fo:inline>
  </template>

This seems to work as designed, but unfortunately it is drawing the
graphic inside the table cell (to the left of the marked entry) and
not in the margin. Any help or pointers is greatly appreciated.

-bpopp

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>