Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2007, 07:53 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rendering base64 images from XML in XSLT

I have images that are encoded in XML. Like..
Code:
<EmployeePicture content-encoding="base64" content-type="image/pjpeg" filename="pic.jpg">/9j/4AAQSkZJRgABAgEAlgCWAAD/
</EmployeePicture>
I have the node <EmployeePicture>, but how can i render the pic embedded in XML through XSL?
 
Old June 27th, 2007, 08:28 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This can't be done without extensions, so it depends very much on the environment you are working in.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 27th, 2007, 08:50 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

would you like to explain a little bit- perhaps by listing down any of the solutions you had already implemented?

Thanks

 
Old June 28th, 2007, 04:32 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

..using bea weblogic 8.1 on XP machine

 
Old June 28th, 2007, 07:13 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

After some research, I have come up 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?

 
Old June 29th, 2007, 01:51 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any replies

 
Old June 29th, 2007, 04:32 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't add anything to my previous response. You can't do this within the XSLT language. You will have to call out to some other technology, and the way you do it depends on your environment. You need (a) to convert the base64 to a stream of bytes or octets, (b) to write those bytes to a file, and (c) to generate in your HTML a link that points to that file. None of that is very difficult, but it's outside the scope of what XSLT can do, even in 2.0.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 29th, 2007, 07:56 AM
Authorized User
 
Join Date: Apr 2005
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the java function as i wrote in an earlier reply. The function intakes the string and returns a byte array.

Now the problem is that I am having exception in calling java function from my XSL (XalanXPathException: The function number 'http://xml.apache.org/xslt/java:com.utilities.ConversionUtils.base64DecodeStr ing' is not available.)






Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Captcha Script not rendering images - broken crmpicco Beginning PHP 2 October 13th, 2007 07:45 AM
XSLT rendering problems in IE7 for Vista tripecac XSLT 17 July 4th, 2007 10:07 AM
XML Rendering HelmutArnold Reporting Services 0 November 1st, 2006 11:12 AM
Rendering images with XSLT trufla XSLT 1 May 21st, 2006 11:37 AM
getting data from XML rendering with XSL louismanukonda XSLT 1 January 4th, 2006 10:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.