[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL-FO & Images

Subject: Re: XSL-FO & Images
From: JBryant@xxxxxxxxx
Date: Mon, 18 Apr 2005 11:27:02 -0500
xsl fo external graphic
> 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>
  <bathrooms>2 on-suite</bathrooms>

Then you need two templates that look like this:

<xsl:template match="Item">
  <!-- Do whatever other stuff you need to do -->

<xsl:template match="image">
  <fo:block><fo:external-graphic src="."/></fo:block>

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)

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.