开发者

How to encode a image in XML file with help of XSLT

I want to send an image (.JPG) through an XML file. How can I encode the image data in the XML file with help of XSLT file so that a user can see the image in Outlook? The image is not in a shared folder location; it is in my personal folder but the user should able to see image.

I have worked out and I got three ways to solve the problem:

  1. CDATA
  2. BASE64
  3. Just creating a URL reference to the image in 开发者_StackOverflow中文版the XML

I worked on CDATA and BASE64 but image is not coming out on the user's Outlook. So please help me work out how to get the image. How can I write code in XML or XSLT so that I can view the image? Is it possible?


If I understand your question correctly, you want to send an image in an email. If this is the case, then, AFAIK, you have two options:

  • send the image as an attachment to the email: in this case you may want to look at MIME

  • another option is sending an HTML email, in which the body of your email is essentially an HTML snipped: in this case you can put in the HTML a link (URL) to your image

In both cases I don't see how you can do this with XML/XSLT. Maybe you have some XML containing some data that you want to send by email, including the link to an image. If this is the case, then you can use XSLT to transform your input XML into (X)HTML and then use HTML e-mail.


I think you need more than XML/XSLT to do what you want. Perhaps this will help.


You could also try (using base64):

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />

or

in more custom using CSS (set height and width appr):

div.image {
  background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA...);
}

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜