dragoncat Posted September 1, 2013 Share Posted September 1, 2013 Below is an example of my code. The item tag loop through my code many times: <item> <title>Secret Court Palace Gardens</title>`enter code here`<link></link><description><p><a href=>aataka</a> has added a photo to the pool:</p><p><a href= title="Hampton Court Palace Gardens"><img src= width="240" height="107" alt="Secret Court Palace Gardens" /></a></p></description></item> I need to select the url value in the 'img src' tag inside the 2nd 'a' tag. I tried something like below but didn't work. Can anyone help? Thanks very much. <?xml version='1.0'?> <xsl:stylesheet version="2.0" xmlns:xsl= xmlns:media=><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> Link to comment Share on other sites More sharing options...
Martin Honnen Posted September 4, 2013 Share Posted September 4, 2013 Given the XML you have the "a" elements are children of the "p" elements so you would need to use <xsl:for-each select="rss/channel/item/description/p[2]"><img src="{a/@href}" style="margin:5px 5px" /></xsl:for-each> Link to comment Share on other sites More sharing options...
dragoncat Posted September 6, 2013 Author Share Posted September 6, 2013 Hi Martin. Thanks a lot. I think that should work! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now