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
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: 18672
    
    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: 18672
    
    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: 18672
    
    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