|
next
|
Subject: Please help!! XML AND XSL Transform with Embedded Image Author: (Deleted User) Date: 27 Jul 2007 10:40 AM
|
Hi Joe,
if it were JPEG, the decoded stream should contain the "JFIF" string in the first few bytes; but if you take the beginning of the content of the <image> tag (e.g. 89504E470D0A1A0A0000000D494844520000016D000001900806000000650D31) and paste in the form at http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/Default.aspx you will get back something that has several M4 strings, but nothing that resembles an image format.
Unless the format is not even base64....
Got it: the format is simply the hex dump of the image, and the image is really a PNG (the 49484452 sequence found in the first few letters is the string IHDR, used by the PNG format).
So you should convert the stylesheet to be XSLT 2.0 and use the new datatypes it provides to convert the hexdump into base64, then you could use the 'data:' URL scheme to tell your (Firefox, IE doesn't support it) browser to load the image form the URL itslef.
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.stylusstudio.com/xquery"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="/">
[....]
<IMG src="data:image/png;base64,{xs:base64Binary(xs:hexBinary(/Summary/New_Record/image))}"/>
If you need to be compatible with IE, you will have to save the use a Java extension function to save the data to a temp file, and reference that file in the IMG tag.
Hope this helps,
Alberto
|
|
|