Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2009-04-27
5
Medium Priority
?
864 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:kipl20
  • 2
  • 2
5 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 24240747
where do you get the text string from?
is it like that in the source XML?
Then you should use the attribute disable-output-escaping="yes" on your xsl:value-of
Els you should just output it correctly
0
 

Author Comment

by:kipl20
ID: 24240771
worked perfect thanks

i used this

<td><xsl:value-of select="img" disable-output-escaping="yes"/></td>
0
 
LVL 39

Expert Comment

by:abel
ID: 24240774
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.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24240780
welcome
0
 
LVL 39

Expert Comment

by:abel
ID: 24240782
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

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question