Consume Google Weather API

Example of using Google's secret Weather API.

Smartsite SXML CopyCode image Copy Code
<se:xmlprocessor>
    <se:parameters>
        <se:parameter name="xml" trim="both">
            <se:cache maxage="00:20" trim="both" keydependencies="|loc={request.query(loc)}|">
                <se:embeduri location="{url.setparameter('http://www.google.com/ig/api', 
                    weather, request.query(loc, 
                    default='Delft, The Netherlands'))}" 
                    resulttype="xml"
                />
            </se:cache>
        </se:parameter>
        <se:parameter name="actions">
            <se:collection>
                <se:member query="//temp_c/@data">
                    {this.setresult(this.getvalue())}
                </se:member>
            </se:collection>
        </se:parameter>
        <se:parameter name="resultformat" trim="both">
            Temperatuur: {this.result()}&deg;
        </se:parameter>
    </se:parameters>
</se:xmlprocessor>
Example Result CopyCode image Copy Code
Temperatuur: 7&deg;