dragoncat Posted September 1, 2013 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>
Martin Honnen Posted September 4, 2013 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>
dragoncat Posted September 6, 2013 Author Posted September 6, 2013 Hi Martin. Thanks a lot. I think that should work!
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