WordPress.org

Ready to get started?Download WordPress

Forums

last.fm, inlineRSS and xslt parsing (1 post)

  1. ivancastell
    Member
    Posted 7 years ago #

    Hi,

    My free webhosting doesn't support fsockopen. I'm trying to get information from my last.fm profile and all the plugins (except those that only retrieve the recent tracks rss) like scrobbler and ez-scrobbler doesn't work.

    Finally I'm able to get information from my last.fm services (like weekly album and weekly artist charts) via inlineRSS and fetching the xml files from my profile. The styling is done via xslt files.

    Now I'm able to get the weekly album chart correctly with this xslt file:

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    exclude-result-prefixes="xml">
      <xsl:output omit-xml-declaration="yes" indent="no"/>
      <xsl:strip-space elements="*"/>
      <xsl:param name="limit" select="10" />
      <xsl:param name="class" />
    
      <xsl:template match="/">
        <xsl:apply-templates/>
      </xsl:template>
    
      <xsl:template match="album">
        <xsl:if test="position()<=$limit">
          <xsl:element name="li">
    	<xsl:if test="$class!=''">
    	<xsl:attribute name="class"><xsl:value-of select="$class" /></xsl:attribute>
    	</xsl:if>
    	<a href="{url}"><img src="{image}" alt="{artist} - {name}" title="{artist} - {name}" /></a>
          </xsl:element>
        </xsl:if>
      </xsl:template>
    
    </xsl:stylesheet>

    The images are not retrieved because the weekly album chart doesn't have image in the xml.

    My problem is with the weekly artis chart, because I don't know what xslt parsing does it need to format it correctly, like the album chart. I've tried to change <xsl:template match="album"> to <xsl:template match="artist"> but it doesn't work.

    Can someone help me with the xslt for the artist weekly chart?

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic