[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Preloading Images
> Given the XML: > > <?xml version="1.0"?> > <LeftNavList> > <PreLoadImage>images/image1</PreLoadImage> > <PreLoadImage>images/image2</PreLoadImage> > <PreLoadImage>images/image3</PreLoadImage> > </LeftNavList> > > I would like to generate the following html snippet: > > <body bgcolor="#ffffff" onLoad="PreloadImages > ('images/image1.gif','images/image2.gif','images/image3.gif');"> > Someone gave you a simple solution by redefining the problem, but for the record, it's not difficult to get the output you want. Write: <xsl:template match="LeftNavList"> <body bgcolor="#ffffff"> <xsl:attribute name="onLoad">PreloadImages( <xsl:for-each select="PreLoadImage"> '<xsl:value-of select=".">.gif' <xsl:if test="position()!=last()">,</xsl:if> </xsl:for-each>);</xsl:attribute> </body> </xsl:template> You may want to adjust that a bit for whitespace. Mike Kay 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
|