freedeveloper
freedeveloper

Reputation: 4102

How to read a embedded image from xml file with xsl

I have a image embedded in a XML file (no the path, the image bits).

<image>Image pixels encoded in 64<image>

then my question is if it is possible make a transformation XSL to HTML over the xml file and show the image embedded.

Thanks

Upvotes: 0

Views: 1252

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

These days browsers have good support for data URLs so you can use e.g.

<xsl:template match="image">
  <img src="data:image/gif;base64,{.}"/>
</xsl:template>

if your XML image element(s) contain GIF image data. You need to adapt the MIME type obviously if you have PNG or JPEG images for instance.

Upvotes: 1

Related Questions