Translating itunes affiliate rss via xslt

Posted by jd on Stack Overflow See other posts from Stack Overflow or by jd
Published on 2010-03-25T19:02:37Z Indexed on 2010/03/25 19:13 UTC
Read the original article Hit count: 393

Filed under:
|
|

I can't get this working for the life of me. Here is a snippet of the xml I get from an RSS feed from itunes affiliate. I want top print the values within tags but I cannot for some reason:

<?xml version="1.0" encoding="utf-8"?>

    <feed xmlns:im="http://itunes.apple.com/rss" xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
            <id>http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/sf=143441/limit=100/genre=6014/xml</id><title>iTunes Store: Top Paid Applications</title><updated>2010-03-24T15:36:42-07:00</updated><link rel="alternate" type="text/html" href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?id=25180&amp;popId=30"/><link rel="self" href="http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/sf=143441/limit=100/genre=6014/xml"/><icon>http://phobos.apple.com/favicon.ico</icon><author><name>iTunes Store</name><uri>http://www.apple.com/itunes/</uri></author><rights>Copyright 2008 Apple Inc.</rights>

                    <entry>
                            <updated>date</updated>

                                    <id>someID</id>

                                    <title>a</title>
                                    <im:name>b</im:name>
                    </entry>
                    <entry>
                            <updated>date2/updated>

                                    <id>someID2</id>

                                    <title>a2</title>
                                    <im:name>b2</im:name>
                    </entry>
    </feed>

If I try <xsl:apply-templates match="entry"/> it spits out the entire contents of file. If I use <xsl:call-template name="entry"> it will show only one entry and I have to use <xsl:value-of select="//*[local-name(.)='name']"/> to get name but that's a hack. I've used xslt before for xml without namespaces and xml that has proper parent child relationships but not like this RSS feed. Notice entry is not wrapped in entries or anything.

Any help is appreciated. I want to use xslt because I want to alter the itunes link to go through my affiliate account - so something automated wouldn't work for me.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about rss