I am trying to process ATOM search results from twitter using the umbraco.library:GetXmlDocumentByUrl.
I have very much copied the approach from the Twitter4Umbraco project where I know this works, however when applying this to the ATOM search xml, I am having difficulty using xpath to drill down into the document.
Here is what I have:
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPExsl:stylesheet [ <!ENTITYnbsp" ">]><xsl:stylesheetversion="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"exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "><xsl:outputmethod="xml"omit-xml-declaration="yes"/><xsl:paramname="currentPage"/><xsl:templatematch="/"> <xsl:variablename="MyFeed"select="umbraco.library:GetXmlDocumentByUrl('http://search.twitter.com/search.atom?q=umbraco')" /> <!-- this works - shows me the contents of the variable --> <textarea> <xsl:copy-ofselect="$MyFeed" /> </textarea> <br /> <!-- this doesn't :( --> <textarea> <xsl:copy-ofselect="$MyFeed//feed/entry" /> </textarea> <!-- Once its working, I want to-do something like this --> <xsl:for-eachselect="$MyFeed//feed/entry"> <xsl:apply-templatesmode="result"select="current()"/> </xsl:for-each></xsl:template><xsl:templatematch="entry"mode="result"> <!-- Once I'm here, I can do my stuff! but for now .. --> <div> <p> <xsl:value-ofselect="title" /> </p> </div></xsl:template></xsl:stylesheet>
Im pretty sure its got somehting todo witht the namespaces being used in the document held in the variable, however i'm losing the plot a little trying to get this to work!
Processing Twitter ATOM results with XSLT
I am trying to process ATOM search results from twitter using the umbraco.library:GetXmlDocumentByUrl.
I have very much copied the approach from the Twitter4Umbraco project where I know this works, however when applying this to the ATOM search xml, I am having difficulty using xpath to drill down into the document.
Here is what I have:
Im pretty sure its got somehting todo witht the namespaces being used in the document held in the variable, however i'm losing the plot a little trying to get this to work!
Any help much appreciated.
Thanks,
Adam
Hi Adam,
You are indeed right - namespaces are trippin' you up; but easy to fix:
Add the namespace declarations from the source to your XSLT - choose a prefix for the atom namespace too, and do something like this:
/Chriztian
Many Thanks Chriztian - All working now :)
is working on a reply...