Subject:Please help!! XML AND XSL Transform with Embedded Image Author:Joe Tailor Date:26 Jul 2007 04:19 PM Originally Posted: 26 Jul 2007 09:37 AM
I have an embedded image in my xml document, I created an xsl, but for some reason when I render it the Image will not show. I have tried everything I have read but have had no luck any ideas what i am doing wrong?
Thanks.
I have attached my file so you can see what I mean
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.
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.
Subject:Please help!! XML AND XSL Transform with Embedded Image Author:Joe Tailor Date:27 Jul 2007 10:50 AM
WOW, I was told they were jpegs I was pulling from the data base. Boy that was a really helpfull reply, Thank you so much!
At least now I know I can not do it through encoding because its gotta be IE compatible.
Ok so <Img> tags ,I have been trying to do it through an image tag but I have had no luck. for some reason my dynamic variable will not show, I actually posted this in a new topic called "Why is this variable not showing?"
Thanks again for taking the time with a frusterated and pressed for time xml newbie =)