Subject:Rendering base64 images embedded in XML Author:(Deleted User) Date:28 Jun 2007 07:34 AM
Hi Steve,
if your XSLT generates HTML, and the final browser supports it, you can try using the data: protocol (see http://developer.mozilla.org/en/docs/The_data_URL_scheme for more details). Or, if the file that is referenced in the XML already exists, you can create an <img> tag that points to it; otherwise you should be using XSLT 2.0 to write the data to a file and then use the <img> tag.
Subject:Rendering base64 images embedded in XML Author:Steve Nicolson Date:28 Jun 2007 08:11 AM
The file is not referenced but contained within the XML file as binary data. Acc to your suggestion I guess I'll have to use XSLT 2.0 to write the data to a file and then use the <img> tag. Please provide more suggestions on this technique.
On the other hand, i came up with another option after some R&D. i.e. i have a java function (public static byte[] b64DecString(String s)) which converts the string into a byte array. The problem with this is that how can i use this external function in my XSL? do i need to upload the xsl on my server to get the java function work?
Subject:Rendering base64 images embedded in XML Author:(Deleted User) Date:28 Jun 2007 08:48 AM
Hi Steve,
supports for invoking Java extension functions depends on the processor used; to see an example of how this can be done, look at the IntDate.xsl example that you find in the examples that ship with Stylus Studio.
Subject:Rendering base64 images embedded in XML Author:Steve Nicolson Date:29 Jun 2007 02:03 AM Originally Posted: 29 Jun 2007 01:45 AM
If the example is included in any of the trial versions of Stylus Studio, available for free in other words, then i don't think if there is any harm in sharing the file; also as the forum title suggests "XSLT Help and Discussion" :o)
Newyz i'll go download stylus in any case once i am done with this task. i have heard a bit about the goodness it can bring to developer's work ;)
Subject:Re: Rendering base64 images embedded in XML Author:(Deleted User) Date:29 Jun 2007 09:23 AM
Hi Steve,
have you checked that the JAR file with the function is specified in
the CLASSPATH?
Once that is verified, I would also write a different function in
Java that receives the string with the base64 data and a string with
a filename, and internally does the conversion plus the writing;
otherwise you could have problems mapping the byte[] datatype into an
XSLT type.
Subject:Re: Rendering base64 images embedded in XML Author:(Deleted User) Date:03 Jul 2007 03:50 PM
Hi Steve,
I'm sorry, but I don't know what to suggest; I don't know how DreamWeaver works, and your (unnamed) application server seems to have even more serious configuration problems....
The only suggestion left is to turn this question to the appropriate forum.
Subject:Re: Rendering base64 images embedded in XML Author:Steve Nicolson Date:06 Jul 2007 06:11 AM
Thanks again Alberto
While exploring the stylus (javaExtension) example that you referenced earlier, I found this IntDate.xquery file.
[code]
declare namespace ext = "ddtekjava:IntDate";
declare function ext:getDate($year as xs:double, $month as xs:double, $day as xs:double, $format as xs:string) as xs:string external;
for $date in /doc/date
return ext:getDate($date/@year, $date/@month, $date/@day, $date/@format)[/code]
I just got the feeling that I had been missing on this file. Could you tell a bit about what is the purpose of this file, and how should i be using it if i am to call my external java function.
Subject:Re: Rendering base64 images embedded in XML Author:(Deleted User) Date:06 Jul 2007 09:18 AM
Hi Steve,
the IntDate.xquery performs the same operation of the IntDate.xsl, the only difference being the language in which it is implemented (XQuery vs XSLT). You should check if your application server can process XQuery transformations before trying to use this sample.