Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: IMAGE DISPLAY

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 8/7/2007 6:11:00 PM

If you're using XSLT to create the HTML content server-side, an
alternative to turn that on its head is to send the 'real' image URL
in the src attribute, but add an onError = bla handler, such as 


<script language="javascript1.2">
function replace_blank() {
	image_id = event.srcElement.id;
	document.getElementById(image_id).src="/images/spacer.gif";
}
</script>

<img id="image_id_number" src="/output/of/your/xsl/transform"
onerror="replace_blank()" />


N.B : To use HTML ID, each element should have a unique ID, you can
use XSL such as this to generate a sequence by position :

<img>
	<xsl:attribute name="src"
select="/guestbool/ROOT/jVehicletype" />
	<xsl:attribute name="id">image_id<xsl:value-of
select="position()" /></xsl:attribute>
</img>

HTH
Cheers - Neil

On Mon, 6 Aug 2007 22:00:47 +0100, "Anthony Jones"
<Ant@y...> wrote:

>"Simon Gare" <simon@s...> wrote in message
>news:Oh3tbhD2HHA.1168@T......
>> Hi Anthony,
>>
>> thanks for the reply, the src is determined by the XML file as the image
>is
>> dynamic based on a selection which makes the src undeterminable in advance
>I
>> thought you could assign a dynamic value such as
>>
>> <img src="<%= bVehicle_type %>">
>>
>> but that didn't work. Are you trying to say that I need the spacer.gif
>file
>> in the src anyway but will be replaced by the XML value based on the image
>> id?
>>
>> Or maybe if I Dim the aspect on the asp page itself that would work?
>>
>
>
>You seem to be confused about what happens on the client and what happens on
>the server.
>
>Things like this:-
>
><img src="<%= bVehicle_type %>">
>
>is server side code in an asp file but this:-
>
>document.getElementById("bVehicle_type").value = ...
>
>is client side code running in the browser.
>
>The answer to you question is yes unless you want an ugly "unknown image"
>icon in you page you need to give your img a valid src to something
>invisible.  On your client with the XML loaded you can then assign the src
>element.  Like I said you need be careful that any relative url you assign
>is appropriate to the pages BaseURL.
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent