I just cant seem to get any output? I tried alot of different ways now, i also had it in a for each, but that didn't seem logic since im only getting one single "current_condition" element.
I tried this and got myself a funny error coming up. When you change the city to ex. hilleroed,denmark I get an error, but no error in aalborg,denmark. How's that possilbe? It's just a url-string.
It's the version with aalborg that works fine, but try to change it with another city. An error occure saying System.Xml.XmlException: An error occurred while parsing EntityName. Line 5, position 62.
Is it something some of you guy's have tried also?
Parsing external XML from a API
Hi
I have the following piece of XSLT in a xslt template
<xsl:variable name="weatherUrl" select="'http://www.google.com/ig/api?weather=aalborg,denmark'" />
<xsl:variable name="xmlnodes" select="umbraco.library:GetXmlDocumentByUrl($weatherUrl)"/>
<xsl:value-of select="$xmlnodes//xml_api_reply/weather[1]/current_conditions/condition" />
http://www.google.com/ig/api?weather=aalborg,denmark
I just cant seem to get any output? I tried alot of different ways now, i also had it in a for each, but that didn't seem logic since im only getting one single "current_condition" element.
Thanks in advance =)
Malte,
You have to do something like
/*[local-name()='xml_api_reply']/*[local-name()='Weather'][1] etc etc
Regards
Ismail
I tried doing it the way Warren did in his twitter package. And from what i can see it should work?
Malte,
I worked on something ages ago where i was pulling down google kml and the only way i could xpath into it was using local-name()=
Regards
Ismail
Okay, thank you =)
The following "works"
<xsl:for-each select="$xmlnodes/xml_api_reply//weather">
<xsl:value-of select="@mobile_zipped" />
</xsl:for-each>
It outputs the value of the attribute "mobile_zipped" from the weather node which is 1
But when i try this
<xsl:value-of select="/current_conditions/condition" />
.. Nothing
Banging my head against the door....
I got it working.
<xsl:variable name="weatherUrl" select="'http://www.google.com/ig/api?weather=aalborg,denmark'" />
<xsl:variable name="xmlnodes" select="umbraco.library:GetXmlDocumentByUrl($weatherUrl)"/>
<xsl:for-each select="$xmlnodes/xml_api_reply/weather/current_conditions">
<xsl:value-of select="condition/@data" /> <br />
</xsl:for-each>
I missed the fact that it was an attribute, and not a value inside the node.. =)
I tried this and got myself a funny error coming up. When you change the city to ex. hilleroed,denmark I get an error, but no error in aalborg,denmark. How's that possilbe? It's just a url-string.
Here is the xslt:
It's the version with aalborg that works fine, but try to change it with another city. An error occure saying System.Xml.XmlException: An error occurred while parsing EntityName. Line 5, position 62.
Is it something some of you guy's have tried also?
/Niels
is working on a reply...