Sorry to reply to my own post but I made an error.
<xsl:template match="image">
<fo:block><fo:external-graphic src="."/></fo:block>
</xsl:template>
should be
<xsl:template match="image">
<fo:block><fo:external-graphic src="{.}"/></fo:block>
</xsl:template>
Sorry about that.
You don't always need the url() function, by the way. If you are creating
a document from the command line and the image files are in the local file
structure, you can drop the url function. That's SOP for me, since I use
FOP in an offline (not over a server) document production environment.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
JBryant(_at_)s-s-t(_dot_)com
04/18/2005 11:27 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc
Subject
Re: [xsl] XSL-FO & Images
Are there any ways of using the "<fo:external-graphic>" tag
in a scalable manner? i.e. run through my XML document,
match all the "<image>" tags and populate a table?
Sure. The same way you do it for XHTML output. fo:external-graphic fills
the same role as the XHTML img element.
So, if you have multiple images, you apply the same template to each one.
For example, if your XML structure looks like this:
<Item suburb="Clifton">
<name>77 Seascape Ave</name>
<description>On the foot of the infamous Table Mountain. </description>
<price>4 500 000</price>
<bedrooms>4</bedrooms>
<bathrooms>2 on-suite</bathrooms>
<lounge>2</lounge>
<dinner>1</dinner>
<garages>2</garages>
<image>seascape.jpg</image>
<image>seascape2.jpg</image>
<image>seascape3.jpg</image>
</Item>
Then you need two templates that look like this:
<xsl:template match="Item">
<!-- Do whatever other stuff you need to do -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="image">
<fo:block><fo:external-graphic src="."/></fo:block>
</xsl:template>
What you'll end up with in your .fo file is this:
<fo:block><fo:external-graphic src="seascape.jpg"/></fo:block>
<fo:block><fo:external-graphic src="seascape2.jpg"/></fo:block>
<fo:block><fo:external-graphic src="seascape3.jpg"/></fo:block>
If you need a table, create the table in the Item template and wrap the
row and cell elements around the blocks in the image template.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--