Search

Ho do you get to an image/user profile pic in an atom feed from twitter?

If have this, but I noticed there are 2 link types.. html and image/png.

<img src="{atom:link/@href}"/>

But the feeds link node is written like this:<link type="image/png" href="image.png" rel="image"/>

So just wondering what syntax is best to target the href part of this node if there is another link type in the entry with html as it's type: <link type="text/html" href="link.com" rel="alternate"/>

Any pointers?

Can you post your full xsl?

You probably want to target the link based on the rel attribute, so something like this:

<img src="{atom:link[@rel = 'image']/@href}"/>

That's the ticket! cheers czheng!

How does it work if the size attribute is the last bit in the node?

i.e album/track/image is my node tree.. but there are 4 images with attributes of

<image size="small" />
<image size="medium" />
<image size="large" />
<image size="extralarge" />

And I tried this <img src="{image/[@size = 'medium']}" /> but I get an error that it's an invalid expression..

It's cool, I just used the count to get to the medium image <img src="{image[2]}"/>

This should work:

<img src="{image[@size = 'medium']}" />

Ahh I see.. without the / in the syntax. Cheers Nils. the count thing works as well.. just nice to know where I was going wrong on the code side.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details