The most likely thing to cause a problem with displaying our
weather conditions is the availability of the weather feed from the NWS. So, we
want to plan ahead for that by creating a default XML file that can be loaded
if the feed becomes unavailable.
The default XML in my example simple displays a messaging
stating that weather information is not currently available. If you look back
up at the XSL in Listing 2 you will notice that there is not a test to see if
the location and observation time nodes exist. This is because they are in the
default XML file. The other nodes are not in the default XML file so the check
is made to suppress the labels. As an alternative you could just hide the XML
control in the web page or have the XSL display nothing at all.
I have created an example default XML file which is shown in
Listing 3. Name the XML file Weather.xml and place it in the App_Data folder of
your web application.
Listing 3 - This is the default XML file that will
be loaded when the weather feed is unavailable.
<?xml version="1.0" encoding="utf-8" ?>
<observation_time>Is Not Available</observation_time>