如何在 XSLT 的帮助下对 XML 文件中的图像进行编码

问题描述:

我想通过 XML 文件发送图像 (.JPG).如何在 XSLT 文件的帮助下对 XML 文件中的图像数据进行编码,以便用户可以在 Outlook 中看到图像?图像不在共享文件夹位置;它在我的个人文件夹中,但用户应该能够看到图像.

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. 只需在 XML 中创建对图像的 URL 引用

我在 CDATA 和 BASE64 上工作,但图像没有出现在用户的 Outlook 上.所以请帮我弄清楚如何获取图像.如何用 XML 或 XSLT 编写代码以便我可以查看图像?可能吗?

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?

你也可以试试(使用 base64):

You could also try (using base64):

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

更多自定义使用 CSS(设置高度和宽度 appr):

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

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

来源