Link to home
Start Free TrialLog in
Avatar of kipl20
kipl20

asked on

how do i pass an image source over from xml using xslt?

hi,

i am trying to get an image to display in a table on a html page generated by an xsl dcoument.

i am using this line <img> &lt;img src="untitled.bmp"&gt; </img>
 but it will convert the same over in the generated html page. how do i send over the < and > tags so they are formetted for html?

thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kipl20
kipl20

ASKER

worked perfect thanks

i used this

<td><xsl:value-of select="img" disable-output-escaping="yes"/></td>
If this is your XSLT:

<xsl:template match="/">   <img> <img src="untitled.bmp"> </img></xsl:template>
then indeed you will have the behavior you mentioned. Instead, try this:

<xsl:template match="/">   <img src="untitled.bmp" /> </xsl:template>

you should not try to make elements out of text in XML/XSLT. Instead, just declare them as elements and you should be fine.
aha, that was quick, Geert! Answered and accepted while I was still typing ;-)

And I see now that the resolved bugs of EE did not really work with &gt etc. I meant the following (for completeness sake, though the original problem was already solved):

<!-- wrong -->
<xsl:template match="/">
  <img> &lt;img src="untitled.bmp"&gt; </img>
</xsl:template>
 
<!-- correct -->
<xsl:template match="/">
  <img src="untitled.bmp" />
</xsl:template>

Open in new window