Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML + Image

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi

I'm a newbie to XML and just want to know hoe to imclude an image in my XML document and display it using XSL Style sheet. I know this is probably a really stupid question but I've no idea.

Thanks

Rachael
 
Did you want to include the actual binary image data in your xml shet or just a filename/path?
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
I'd recommend you go with Tarwn's idea. Store some identifier or even the filename (if you're only using the XML document locally) and have the XSL create a link. That's what's usually done around here when generating HTML pages.

Uura
~~~~
"Common sense tells you that the world is flat."
 
Well, I acutally forgot the part where I was going to suggest file paths, but thanks for seeing what I was thinking and forgot to write :) ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
I have a question of similar nature, but my involves stored procedure using FOR XML to creat the XML and using XSL to transform the XML data. But my problem is that XML source does not contain an image element. How I do display a filename image in XSL.

Here is part of my code in XSL:
<xsl:choose>
<xsl:when test=&quot;not($verify='0')&quot;>
<td align=&quot;center&quot;><font class=&quot;green&quot;>verify</font></td>
</xsl:when>
<xsl:eek:therwise>
<td>0</td>
</xsl:eek:therwise>
</xsl:choose>

I want to replace the <font class=&quot;green&quot;>*</font> with an image instead.

I tried replacing it with <img src=&quot;images/test/image.gif&quot;>. It gave me an error:
&quot;Unable to Load XSL File!XSLTransform&quot;

Any help is appreciated.
Thanks
CF
 
Try:
Code:
<img src=&quot;images/test/image.gif&quot; />
All tags must close.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
In your XML file, you could use something like:

<picture location=&quot;/path/file.jpg&quot;/>


To display this using XSL, you could use:

<IMG BORDER=&quot;0&quot;><xsl:attribute name=&quot;src&quot;><xsl:value-of select=&quot;./picture/@location&quot;/></xsl:attribute></IMG>



of course you can add extra attributes to the XSL either directly or as attributes in the XML




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top