It should be fairly easy to achieve using GetXMlDocumentByUrl - but sometimes it can be easy to overlook namespaces from the imported feed, which should be added. (I've had my share :-))
Can you perhaps provide us with your XSLT code and the format of the XML you're trying to parse.
I don't know how to use the Parse extension to do this. I have tried but I'm getting a "value must not be null" error in the umbraco XSLT editor that I can't really make any sense of at the moment. Maybe some of the bright minds behind uComponents can show us how to use it? :-)
However I managed to import the XML using the umbraco.library:GetXMLDocumentByUrl extension.
I have written the XML output in a textarea so it's easy to grab and see what to match in the XSLT. Next I have just matched the query element to see if I'm actually getting a value. And I am. So you should be ready to parse and present the data from the feed now.
Please do also notice that I have escaped the & charachter, so it says & so the XSLT parser does not fail.
That's great it does work. I think the & escape did the job, that was the missing thing. I still haven't the ucomponents function working for me with or without the escape trick, maybe someone can help us on that.
Trying to import an external weather xml feed with no luck
Hello,
Trying both the umbraco.library:GetXmlDocumentByUrl(url) and the ucomponent ucomponents.xml:Parse('String xml')
I am getting this error when using the umbdebugshowtrace=true on my url.
XSLT compile error.
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
at System.Xml.Xsl.Xslt.XsltLoader.Load(XmlReader reader)
at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver)
at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil)
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at umbraco.macro.CreateXsltTransform(XmlTextReader xslReader, Boolean debugMode)
at umbraco.macro.getXslt(String XsltFile)
at umbraco.macro.loadMacroXSLT(macro macro, Hashtable attributes, Hashtable pageElements)
Any ideas? It should be something really easy. Namespaces have been added for ucomponents.
Cheers, Giorgos
Hi Giorgios
It should be fairly easy to achieve using GetXMlDocumentByUrl - but sometimes it can be easy to overlook namespaces from the imported feed, which should be added. (I've had my share :-))
Can you perhaps provide us with your XSLT code and the format of the XML you're trying to parse.
/Jan
Hi Jan and thanks for your response,
Here you go
XML Weather Feed
http://www.worldweatheronline.com/feed/weather.ashx?q=35.51,24.01&format=xml&num_of_days=2&key=a19ab7f905210052102012
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.members ucomponents.strings ucomponents.urls ucomponents.xml ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:value-of select="ucomponents.xml:Parse('http://www.worldweatheronline.com/feed/weather.ashx?q=35.52,24.02&format=xml&num_of_days=2&key=a19ab7f905210052102012')"/>
</xsl:template>
</xsl:stylesheet>
Cheers, Giorgos
Hi Giorgios
I don't know how to use the Parse extension to do this. I have tried but I'm getting a "value must not be null" error in the umbraco XSLT editor that I can't really make any sense of at the moment. Maybe some of the bright minds behind uComponents can show us how to use it? :-)
However I managed to import the XML using the umbraco.library:GetXMLDocumentByUrl extension.
The following code should work for you.
I have written the XML output in a textarea so it's easy to grab and see what to match in the XSLT. Next I have just matched the query element to see if I'm actually getting a value. And I am. So you should be ready to parse and present the data from the feed now.
Please do also notice that I have escaped the & charachter, so it says & so the XSLT parser does not fail.
Happy coding.
/Jan
Hi Jan,
That's great it does work. I think the & escape did the job, that was the missing thing.
I still haven't the ucomponents function working for me with or without the escape trick, maybe someone can help us on that.
Cheers, Giorgos
is working on a reply...