Re: img src and xslt
Martin Honnen <[email protected]> Mon, 16 Apr 2007 14:04:50 +0200
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
ksb1454 wrote:
> <item>
> <woodworking>
> <apprentice>
> <title>Campfire Materials</title>
> <desc><img src="heavy_rowan_hammer.JPG"/></desc>
> <mats1>5 Rowan Wood</mats1>
> <mats2>1 Kindling Material</mats2>
> <mats3>1 Ball of Twine</mats3>
> </apprentice>
> </woodworking>
> </item>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <xsl:for-each select="item/woodworking/apprentice">
> <xsl:value-of select="title"/>
> <xsl:attribute name="src"><xsl:value-of select="desc/img/@src"/
>> </xsl:attribute>
You need to create an HTML img element in the result tree e.g.
<img src="{desc/img/@src}"/>
Or you can copy the img element from the source to the result tree e.g.
<xsl:copy-of select="desc/img"/>
--
Martin Honnen
http://JavaScript.FAQTs.com/