Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: IMAGE DISPLAY [Thread Next] Re: IMAGE DISPLAYTo: 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
