Quantcast
Channel: SharePoint 2013 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 26374

How to properly display XML using XSL (trying to display Yahoo weather)

$
0
0

Below is my XSL code which I am using to display Yahoo weather for New York. I am using XML Viewer web part.

Yahoo weather
http://weather.yahooapis.com/forecastrss?w= 2459115&u=c

My code

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <table border="0" width="100%">
      <tr>
        <td colspan="2" class="heading_1"><xsl:value-of select="rss/channel/item/title"/></td>
      </tr>
<tr>
        <td colspan="2" class="heading_1"><xsl:value-of select="rss/channel/item/description"/></td>
      </tr>

          </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

Explanation
The title which is defined in rss/channel/item/title displays fine but the description which is rss/channel/item/description is not being properly displayed. The description contains image which I want to display along with some other selective data. I don't want to display complete description as it is. I think I need to do some find-replace on description but I don't know how to do it. Or may be there is some other way to parse description and display it according to what I need?

Screenshot
http://i.imgur.com/yjLz3jx.jpg

In above screenshot you can see that title which is "Conditions for New York, NY at 4:04 am EDT" is being displayed fine while the text below for description is all jumbled.


Viewing all articles
Browse latest Browse all 26374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>