[xsl] XLST including image in HTML transformation

Subject: [xsl] XLST including image in HTML transformation
From: Matt Gushee <mgushee@xxxxxxxxxxxxx>
Date: Thu, 24 May 2001 14:37:17 -0600 (MDT)
gary cor writes:

 > I hope someone can help.  I have the URI of an image file inside an element 
 > in an XML file I would like the XSL to show the image when it does various 
 > transformations into HTML.

You say URI. Is the URI a URL, or does it have a predictable
relationship to a URL? If so, it should be easy to include a JPEG,
GIF, or PNG in your output. The obvious way is to create a template
such as:

     <xsl:template match="my_graphic">
         <IMG SRC="{@uri}"/>
     </xsl:template>

But perhaps you've tried this. Is there some complication you're not
telling us about?

 > I have tried so many things with no success and am currently running a 
 > script quite seperately which is very difficult to keep adjusting as  the 
 > XML changes.

Can you be more specific? What have you tried?

 > The images are JPEG and there is the possiblitity that some 
 > may also be SVG eventually?

JPEGs are easy, since all you need to do is reference them with an IMG
tag. SVG ... I suppose you would either: (a) if you have the luxury of
assuming the client supports SVG, just dump it into the page (in an
<OBJECT> tag, maybe? I haven't worked w/ SVG myself), or (b) call an
external processor to convert it to one of the standard bitmap
formats.

Matt Gushee
Englewood, CO, USA

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread