How to display img using XSLT
"Chuck" <[email protected]> 19 Feb 2007 21:34:59 -0800
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi, I am new to XSLT and I have an XML file in the format given below. For each item, I would like to diplay the img as a thumbnail (with the src from XML) and the title next to the image in each line: ================ <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="test3.xsl"?> <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"> <item> <title>CNN Title </title> <link>http://www.cnn.com</link> <description><img src="cnnImage.jpg" />This is CNN home page</ description> </item> <item> <title>Yahoo title</title> <link>http://www.yahoo.com</link> <description><img src="yahooImage.jpg" />This is yahoo home page</ description> </item> </html> ============== My code is this, however the image is not being displayed: ---------------------------- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <xsl:output method="html" /> <xsl:template match="/"> <link rel="stylesheet" href="style.css" type="text/css" /> <xsl:for-each select="html/item"> <div> <span> <img width="120" height="90"> <xsl:attribute name="src"><xsl:value-of select="@src"/></ xsl:attribute> </img> </span> <span> <a class="link" style="valign:top"> <xsl:attribute name="href"><xsl:value-of select="link" /></ xsl:attribute> <xsl:value-of select="title" /> </a> </span> </div> <br /> </xsl:for-each> </xsl:template> </xsl:stylesheet> ------------------- I would really appreciate any help regarding this. Thanks