下面是我的代码示例。项目标签多次循环我的代码。
<item>
<title>Secret Court Palace Gardens</title>`enter code here`
<link>htt://www.flickr.com/photos/aataka/954934842/in/pool-1540822@N20</link>
<description>
<p>
<a href="htt://www.flickr.com/people/aataka/">aataka</a> has added a photo to the pool:</p>
<p>
<a href="htt://www.flickr.com/photos/aataka/954934842/" title="Hampton Court Palace Gardens">
<img src="htt://farm4.staticflickr.com/3802/954934842_a38fca47c7_m.jpg" width="240" height="107" alt="Secret Court Palace Gardens" />
</a>
</p>
</description>
</item>
我需要在第二个“a”标签内的“img src”标签中选择 url 值。我尝试了类似下面的方法,但没有奏效。任何人都可以帮忙吗?非常感谢。
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="htt://www.w3.org/1999/XSL/Transform" xmlns:media="htt://search.yahoo.com/mrss/">
<xsl:output method="html" />
<xsl:template match="/">
<xsl:for-each select="rss/channel/item/description/p[2]/*">
<img src="{a/@href}" style="margin:5px 5px" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>