aspose file tools*
The moose likes XML and Related Technologies and the fly likes displaying image in any browser using xsl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "displaying image in any browser using xsl" Watch "displaying image in any browser using xsl" New topic
Author

displaying image in any browser using xsl

N Naresh
Ranch Hand

Joined: Nov 04, 2008
Posts: 66
hi i am using below xsl file to display image in a browser

<?xml version="1.0" encoding="UTF-8"?><content><image border="0" link="http://ec.europa.eu" width="abc' height="abc' src="http://ec.europa.eu/information_society/activities/egovernment/images/project_logos/sample.jpg"/><caption>My image</caption><subcaption>My image</subcaption></content>

the problem here is i am able to display image in firefox, where as in IE i am unable to display image.

could anybody tell me what is the problem.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

That isn't an XSLT file.

It looks more like an XML document, but it's not a well-formed XML document because some of its attributes don't have matching quote characters.

So all I can say is, I'm surprised that Firefox renders it at all. Are you sure you are asking the right question and posting the right information?
N Naresh
Ranch Hand

Joined: Nov 04, 2008
Posts: 66
i am using below xsl file to display above xml file in browser.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="locale">en_US</xsl:param>

<xsl:template match="content">

<p align="center"><xsl:value-of select="caption"/></p>
<p align="center">
<xsl:choose>
<xsl:when test="not(image/@link='')">
<a href="{image/@link}" target="_blank">
<image border="{image/@border}" height="{image/@height}" src="{image/@src}" width="{image/@width}"/>
</a>
</xsl:when>
<xsltherwise>
<image border="{image/@border}" height="{image/@height}" src="{image/@src}" width="{image/@width}"/>
</xsltherwise>
</xsl:choose>
</p>
<p align="center"><font size="2"><xsl:value-of select="subcaption"/></font></p>

</xsl:template>

</xsl:stylesheet>
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

Your XML document is still malformed. And those values for "width" and "height" are... let's just say, not suitable.

And you didn't say where you were doing the transformation. It can't be in the browser, so why not just look at the HTML which is output from the transformation?
N Naresh
Ranch Hand

Joined: Nov 04, 2008
Posts: 66
we are creating xml in java class at runtime and using xsl file to render the xml file in a browser.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

NimmalaN NareshN wrote:using xsl file to render the xml file in a browser.

Can you explain this sentence? Your XML document doesn't have the processing instruction in it which will cause the browser to do the transformation, so you must be doing the transformation somewhere else and then trying to get the browser to render the HTML that it produces.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying image in any browser using xsl
 
Similar Threads
Displaying an image in jsp
Displaying an image from xml source element
xsl or not xsl?
Image will not change on the Browser...Saving on the Tomcat Problem.....HELP...Please
Apache to Tomcat forwarding not working properly