How to show weather in Sharepoint…

the great posting found at Sharepoint University Forum

below the step by step to show weather information from weather.com into your sharepoint.

  • Sign up for the Weather Channel XML: http://www.weather.com/services/xmloap.html
  • Download the SDK. Unzip the “64×64″ and “logos” from the SDK into C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES\weather\, in the sharepoint the path is /_layouts/images/weather/
  • in your sharepoint web part page, add a XML Web part. copy and paste the xsl below with XSL editor….

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes" encoding="iso-8859-1" />
    <xsl:template match="/weather">
    <xsl:variable name="med-img-dir">/_layouts/images/weather/64x64</xsl:variable>
    
    <table width="100%">
        <tr>
            <td align="center" colspan="2">
            <xsl:variable name="zipcode">
            <xsl:value-of select="loc/@id"/>
            </xsl:variable>
            <b><a href="http://www.weather.com/weather/local/{$zipcode}"><xsl:value-of select="loc/dnam"></xsl:value-of></a></b>
            </td>
        </tr>
        <tr>
            <!-- Weather Channel Logo -->
            <td valign="bottom">
            <a href="http://www.weather.com" target="_none">
            <img src="/_layouts/images/weather/logos/TWClogo_64px.png" alt="Weather Channel Logo" border="0" />
    
            </a>
            </td>
    
            <!-- Current Weather Conditions -->
            <td valign="top">
            <table width="100%">
                <tr>
                    <td valign="middle">
                    <table width="80%">
                    <tr>
                        <td>
                        <!-- Weather Conditions Icon -->
                        <xsl:variable name="img-ext">png</xsl:variable>
                        <xsl:variable name="iconnumber">
                        <xsl:value-of select="cc/icon"></xsl:value-of>
                        </xsl:variable>
                        <img src="{$med-img-dir}/{$iconnumber}.{$img-ext}"  alt="{$iconnumber}.{$img-ext}" width="64" height="64" />
                        </td>
                        <!-- Current Temp -->
                        <td valign="middle">
                        <span style="font-size:20px;font-weight:bold;"><xsl:value-of select="cc/tmp"></xsl:value-of>�F</span><br/>
                        <xsl:value-of select="cc/t"></xsl:value-of>
                        </td>
                    </tr>
                    </table>
                    </td>
                </tr>
                <tr>
                    <td>
                    Feels Like: <xsl:value-of select="cc/flik"></xsl:value-of>�F<br/>
                    Humidity: <xsl:value-of select="cc/hmid"></xsl:value-of>%<br/>
                    Wind:  <xsl:value-of select="cc/wind/t"></xsl:value-of> at <xsl:value-of select="cc/wind/s"></xsl:value-of> mph<br/>
                    <input TYPE="TEXT" SIZE="20" VALUE="Enter city/zip" STYLE="font-size:10;" name="where" onFocus="this.value='';" />
                    <input TYPE="image" src="{$med-img-dir}/transparent_orange_go.gif" alt="transparent_orange_go.gif" onClick="window.open('http://www.weather.com/outlook/travel/local/' + document.getElementById('where').value);"  ALIGN="ABSMIDDLE" width="28" height="19" />
                    </td>
                </tr>
            </table>
            </td>
        </tr>
    </table>
    
    </xsl:template>
    </xsl:stylesheet>
    • replace the bold text with your location code. you can find it in the weather portal. Download the “transparent_orange_go.gif” image at here. Place it in layouts\images\weather\64×64 folder.
    • You can download the xsl from the original location, with a little adjustment.
  • In the XML Link, type this link.

    • http://xoap.weather.com/weather/local/(your location)?cc=*&prod=xoap&unit=m&par=null&key=(your registration code)
  • Apply your xml web part configuration. The weather should displayed correctly.
  • CMIIW

19 tanggapan sejauh ini

  1. masardi on

    Mohon pencerahan mengenai MS SQL Server 2000 dan MS Sharepoint Portal Server 2003. Kebetulan saya ingin belajar untuk menggunakan MS SharePoint Portal 2003. Saya sudah menginstall MS SQL Server 2000 di MS Windows Server 2003, kemudian saya install SharePoint Portal Server 2003. Saya mengalami kesulitan pada saat Konfigurasi Setting Database-nya. Mohon bantuannya via email masardiweb[at]gmail[dot]com
    Terima kasih,
    -masardi-

  2. aris wibowo on
  3. Matt on

    I keep getting the following error.

    Any suggestions.

    The XSL specified by the XSL property or XSL Link property is not valid, or the XSL file cannot be accessed. Make sure you have specified a valid XSL style sheet for this Web Part, or if the XSL file is linked that it can be accessed by the server. For assistance, contact your site administrator. More about making XSL files accessible

  4. sri on

    hi
    can you please let me know what are all the changes i got to do while pasting the above code to xsl editor.

    thanks

  5. [...] on how to display weather via RSS feed aggregrator.  I found one article that provides code on how to show weather in Sharepoint; however, I wanted to personalize this for each [...]

  6. Tom Turner on

    My web part id displaying in Celcius even though the description is in Farenheit. I am in Washington State, USA. Any ideas how to edit the code? Thanks.

  7. Tom Turner on

    All,

    If you edit the XML Link ( http://xoap.weather.com/weather/local/(your location)?cc=*&prod=xoap&unit=m&par=null&key=(your registration code) ) and change the unit=m to unit=e; it will change your output from Metric to English. I test it and it works fine. Thanks.

  8. Nick on

    When I use this, I get this message:

    The output from this Web Part may contain an HTML tag, which is not supported in this Web Part. Edit the XML or XSLT source code to remove the HTML tag.

    Can you help me out? I am a complete newbie to all this.

  9. Tom Turner on

    Nick,

    Put the code in the XSL editor window and put the link in the XML Link field. It’s a little tricky and the instructions aren’t very clear but that worked for mine. Good luck.

  10. chris on

    Everything seems to work good except the degree circle shows up as a square. Does anyone know how to correct this? Thanks

  11. Jen on

    The xsl link is no longer available. Does anyone have that content? Thanks for any assistance!
    Jen

  12. Mike on

    My degree shows up as a square rather than a circle as well.

  13. dennistong on

    take a look at nice new blog -

    http://www.bloxster.net/toys/

  14. L. on

    �F
    <
    Feels Like: �F

    Replace the symbol in front of the ‘F’ with the degree symbol in your code to fix the square problem.

  15. subbarao on

    hi,
    i have configured the xmlwebpart with xml link and paste the code in xsl editor.but giving the following error. Please help in this.

    The Web Part has timed out.

  16. Jeremy on

    Or you could just use our free World Clock and Weather Part…its cool, its free, its easy!

  17. Mahmoud on

    where is the bold text that you are talking about it is not there

  18. Justin McSpedden on

    Thanks to Wayne G. for the following solution to the degree symbol issue:

    To correct the degree Farenheit change the first line to read:

    Also you need to add the following in the space where the square is before the “F” for farenheit:

    °

    This will also need to be replaced in the “Feels Like” section.

    Credit goes to Wayne G. for the solution.

  19. Justin McSpedden on

    First line should read ****”"**** or lessthansymbol questionmark xml version equals quote 1.0 endquote encoding equals quote UTF-8 endquote space questionmark greaterthan symbol

    Replace square with ****”°”***** or ampersand pound 176 semi-colon


Leave a reply