Si8
Si8

Reputation: 9235

How to use the IMG tag from an XML file structure

<root>
    <NewsArticle>
        <artTitle>Track</artTitle>
        <artThumb><img alt="ArtThumbOne" src="artOne.png?n=5350" title="ArtThumbOne" align="middle" /></artThumb>
        <artBodyImg><img src="rr.jpg?n=2314" alt="rr" /></artBodyImg>
    </NewsArticle>
</root>

XSL:

<xsl:for-each select="/root/NewsArticle">

  <div class="dispArtBody">
      <img src="{artBodyImg/node()}" alt="{artTitle}" class="floatImgLeft" /><xsl:copy-of select="artText" />
  </div>

  <input type="hidden" value="{artTitle}" id="hdnArticleTitle" />
</xsl:for-each> 

I see the following in the HTML source:

<img src="" alt="The Comprehensive Breast Center: Quality Care on the Fast Track" class="floatImgLeft" />

How do I resolve it.

Upvotes: 1

Views: 5927

Answers (1)

matthias_h
matthias_h

Reputation: 11416

Just change the part for the image to

<img src="{artBodyImg/img/@src}" alt="{artTitle}" class="floatImgLeft" />

Demo

Upvotes: 2

Related Questions