Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

displaying image in any browser using xsl

 
N Naresh
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are creating xml in java class at runtime and using xsl file to render the xml file in a browser.
 
Paul Clapham
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic