Click on this icon to open the XML page.Tom Van Gaever - Blog
Search:   

SharePoint 2010 and XSL - The XML Viewer Web Part - Weather Information - Lesson 1 
Sunday, October 17, 2010, 20:07 - SharePoint
Posted by Administrator
In SharePoint 2007 we could very quickly create a powerful solution without using a single line of server code. The key component for this solution was using SharePoint Designer, the Data View Web Part and XSL. In SharePoint 2010 they have provided us with a web part that allows providing the specific location of an xml file and the location of an xsl file.

The location of the xml file can of course be any link that provides xml, for this demonstration I would like to keep it easy and show that SharePoint 2010 has the mechanisms provided to communicate with other external systems.

1) Add an XML View Web Part to your SharePoint page and open the properties pane


2) Specify the following url in the XML link textbox (http://www.google.com/ig/api?weather=Brussels). As you can see in the url, I've provided Brussels as current location. Of course you are free to provide the city where you are currently located to retrieve your local weather forecast.


3) Provide the following lines of xml in the XSL editor (this xsl will retrieve all the transform all the data from the xml, but there is no css style applied


	
		
		
		
		
			
			http://www.google.com:value-of select="xml_api_reply/weather/current_conditions/icon/@data"/>
			
		
		
		
°C
http://www.google.com
min: °C - max: °C


4) The next xsl snippet has some Cascading Style Sheet embedded. Feel free to reuse it as a base for your own custom style.


	
	
		
		
		
		
		
Current
http://www.google.com
°C
Forecasts
http://www.google.com
min: °C - max: °C


This should be the result in your page:


The web part can also be downloaded from here;
http://tomvangaever.be/blog/sp2010/tvg- ... ebpart.dwp


6 comments ( 145 views )   |  permalink   |  related link   |   ( 3 / 8406 )

<<First <Back | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Next> Last>>