2014-10-30 48 views
1
<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:如何使用IMG標記從XML文件結構

<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> 

我看到HTML源代碼如下:

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

我該如何解決它。

回答

2

只要改變部分的圖像

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

Demo