<description><![CDATA[<p> <img style="margin: 10px; float: left;" alt="Nuevo modelo general de negocio" src="http://mysite.es/images/figure1.jpg" width="196" height="147" /> La compañía apuesta por un marcado giro en el modelo]]> </description>
Could you please provide the full XML structure from your feed? Just one <item></item> element with all of it's content. I just need to see the whole structure in order to suggest how you can try and solve your issue.
Extract src from CDATA in XML file
Hello,
I have this xml code:
<description><![CDATA[<p>
<img style="margin: 10px;
float: left;" alt="Nuevo modelo general de negocio"
src="http://mysite.es/images/figure1.jpg" width="196" height="147" />
La compañía apuesta por un marcado giro en el modelo]]>
</description>
And I have this xslt script:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<div>
<xsl:apply-templates select="rss/channel"/>
</div>
</xsl:template>
<xsl:template match="rss/channel">
<xsl:variable name="link" select="link"/>
<xsl:variable name="description" select="description"/>
<ul><xsl:apply-templates select="item"/></ul>
</xsl:template>
<xsl:template match="item">
<xsl:variable name="item_link" select="link"/>
<li>
<a href="{$item_link}" "><xsl:value-of select="title"/></a>
</li>
</xsl:template>
</xsl:stylesheet>
I need to read the src property to put the image, before the link in the LI list.
Thank you in advanced.
Regards,
María
Hi Maria
Could you please provide the full XML structure from your feed? Just one <item></item> element with all of it's content. I just need to see the whole structure in order to suggest how you can try and solve your issue.
Looking forward to hearing from you.
/Jan
Hello Jan,
thanks for your response! Here is the xml
<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.8.0-dev ([email protected])" -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>RSSNoticiasCORE</title>
<description></description>
<link>http://mysite/</link>;
<lastBuildDate>Sun, 24 Mar 2013 16:45:08 GMT</lastBuildDate>
<generator>FeedCreator 1.8.0-dev ([email protected])</generator>
<image>
<url>[Tab]</url>
<title>Empresa SLU</title>
<link>http://mysite/</link>;
<description><![CDATA[Nombreain SLU]]></description>
</image>
<atom:link href="http://mysite/index.php?option=com_ninjarsssyndicator&feed_id=2&format=raw&lang=es" rel="self" type="application/rss+xml" />
<item>
<title>Liderazgo </title>
<link>http://mysite/index.php?option=com_content&view=article&id=108:liderazgo-&catid=77:noticias&Itemid=662&lang=es</link>;
<description><![CDATA[<p style="text-align: justify;"><img alt="" align="left" src="http://mysite/images/casos_exito/13/golf.jpg" />El ranking de la revista Computerworld, el primero que ofrece datos globales sobre el sector TIC español, confirma un]]></description>
<pubDate>Mon, 18 Mar 2013 11:09:25 GMT</pubDate>
<guid isPermaLink="false">http://mysite/index.php?option=com_content&view=article&id=108:liderazgo&catid=77:noticias&Itemid=662&lang=es</guid>;
</item>
</channel>
</rss>
Regards,
María
Hello, some idea about this answer?
Regards,
María
is working on a reply...