I'm working with a Yahoo weather XML feed, and I can't for the life of me figure out how to access the item I need.
Here is the XML file
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Yahoo! Weather - Sunnyvale, CA</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/94089_f.html</link>
<description>Yahoo! Weather for Sunnyvale, CA</description>
<language>en-us</language>
<lastBuildDate>Wed, 19 Mar 2008 12:27 pm PDT</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Sunnyvale" region="CA" country="US" />
<yweather:units temperature="F" distance="mi" pressure="in" speed="mph" />
<yweather:wind chill="59" direction="20" speed="8" />
<yweather:atmosphere humidity="67" visibility="1609" pressure="30.23" rising="0" />
<yweather:astronomy sunrise="7:12 am" sunset="7:20 pm" />
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com/</link>
<url>http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url>
</image>
<item>
<title>Conditions for Sunnyvale, CA at 12:27 pm PDT</title>
<geo:lat>37.39</geo:lat>
<geo:long>-122.03</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/94089_f.html</link>
<pubDate>Wed, 19 Mar 2008 12:27 pm PDT</pubDate>
<yweather:condition text="Partly Cloudy" code="30" temp="59" date="Wed, 19 Mar 2008 12:27 pm PDT" />
<description><![CDATA[
<img src="http://l.yimg.com/us.yimg.com/i/us/we/52/30.gif" /><br />
<b>Current Conditions:</b><br />
Partly Cloudy, 59 F<BR /><BR />
<b>Forecast:</b><BR />
Wed - Partly Cloudy. High: 61 Low: 45<br />
Thu - Sunny. High: 62 Low: 45<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/94089_f.html">Full Forecast at Yahoo! Weather</a><BR/>
(provided by The Weather Channel)<br/>
]]></description>
<yweather:forecast day="Wed" date="19 Mar 2008" low="45" high="61" text="Partly Cloudy" code="30" />
<yweather:forecast day="Thu" date="20 Mar 2008" low="45" high="62" text="Sunny" code="32" />
<guid isPermaLink="false">94089_2008_03_19_12_27_PDT</guid>
</item>
</channel>
</rss><!-- p4.weather.sp1.yahoo.com compressed/chunked Wed Mar 19 12:51:32 PDT 2008 -->
What I need is the text and temp pulled out of the yweather:condition item above. In my XSL document I can access everything fine using <xsl:value-of select="rss/channel/item/title" /> for example, but whenever I try and reference the yweather item, I don't know how to pull the attributes from inside it. I read about using the @ sign, so <xsl:value-of select="rss/channel/item/yweather:condition/@text" /> should work, but errors the application. I think it has something to do with references the item with a title such as this, yweather:condition
Its got to be something small I'm missing. Any help???