Hardware Reference
In-Depth Information
<xsl:if test="@day = 'Wed'">
<xsl:text>Wednesday</xsl:text>
</xsl:if>
<xsl:if test="@day = 'Thu'">
<xsl:text>Thursday</xsl:text>
</xsl:if>
<xsl:if test="@day = 'Fri'">
<xsl:text>Friday</xsl:text>
</xsl:if>
<xsl:if test="@day = 'Sat'">
<xsl:text>Saturday</xsl:text>
</xsl:if>
<xsl:if test="@day = 'Sun'">
<xsl:text>Sunday</xsl:text>
</xsl:if>
<xsl:text>
description:</xsl:text>
<xsl:value-of select="@text"/>
<xsl:text>
low:</xsl:text>
<xsl:value-of select="@low"/>
<xsl:text>
high:</xsl:text>
<xsl:value-of select="@high"/>
<xsl:text>
end:
</xsl:text>
</xsl:template>
</xsl:stylesheet>
In several places, you will note the strange carriage returns included to produce a friendlier output file.
Because of the CPU time involved in querying these APIs, you download and process them with a script (like the
one shown previously) and store its output in a separate file. In this way, you can schedule the weather update script
once at 4 a.m. and be happy that the data will be immediately available if/when you query it. The weatherstatus
script then becomes as follows:
#!/bin/bash
RESULT_INFO=/var/log/minerva/cache/weather_info.txt
if [ -f $RESULT_INFO]; then
cat $RESULT_INFO
exit 0;
else
echo "No weather data is currently available"
exit 1;
fi
Search WWH ::




Custom Search