Evan
Evan

Reputation: 47

Create and apply image template

I am trying create an apply an image template, but get nothing to display. I am new to this but have been trying for a while and can't seem to find where I am making a mistake. Here is a view of the image template I created and an trying to apply within the root template.

<body>
    <div id="logo">
        <xsl:apply-templates select="rss/channel/image" />
    </div>

<xsl:template match="image">
    <a href="{image/link}">
        <img src="{image/url}" alt="{image/title}" width="{image/width}" height="{image/height}" longdesc="{image/description}" />
    </a>
</xsl:template>

Upvotes: 0

Views: 40

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167716

Well you should post a sample of the XML structure but you probably want

<xsl:template match="image">
    <a href="{link}">
        <img src="{url}" alt="{title}" width="{width}" height="{height}" longdesc="{description}" />
    </a>
</xsl:template>

assuming you have

<image>
  <title>image title<title>
  <url>foo.png</url>
  <width>200</width>
  ...
</image>

Upvotes: 1

Related Questions