[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Preloading Images
Sia Rahimi wrote: > I would like to generate the following html snippet: > > <body bgcolor="#ffffff" onLoad="PreloadImages > ('images/image1.gif','images/image2.gif','images/image3.gif');"> I would predict a few headaches getting your quoting right using that approach. It can be done (reasonably easily) but I'd advise stepping out of the onload to get it done. <body bgcolor="#ffffff" onLoad="doPreloadImages()" > <script> function doPreloadImages(){ Preload('images/image1.gif'); Preload('images/image2.gif'); Preload('images/image3.gif'); } </script> This means you won't have to contend with nested "''" A template could be of the form: <xsl:template match="LeftNavList"> <script> function doPreloadImages(){ <xsl:for-each select="PreLoadImage"> Preload('<xsl:value-of select="." />'); </xsl:for-each> } </script> </xsl:template> Advantages include clearer readability (IMO, although it can be compressed back into your original PreloadImages(..,..,..) if you prefer) and it means the LeftNavList can be matched at any point in the page, instead of attaching itself to the 'body' template. There are more elaborate (generic) approaches and also more succinct ways, like your original, but hopefully this will give you enough pointers. cheers, .dman. :=====================:====================: : Dan Morrison : The Web Limited : : http://here.is/dan : http://web.co.nz : : dman@xxxxxxxx : danm@xxxxxxxxx : : 04 384 1472 : 04 495 8250 : : 025 207 1140 : : :.....................:....................: : If ignorance is bliss, why aren't more people happy? :.........................................: XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|