The problem was that when you apply-templates on the XML, the only template that it matched was the match="/" which would cause an infinite loop.
The way you've got it now using "$xmlcontent/*" is fine, as that applies templates to the child node (in this case the root node aka document element).
If you had to apply-templates at the top root, then you could add a "mode"?
Trying to render external feed causes App Pool Crash
I'm trying to render an external feed using the GetXmlDocumentByUrl library method and it is crashing my app pool, the XSLT file can't even be saved.
Here is the XSLT in it's simplest form:
<?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:atom="http://www.w3.org/2005/Atom"
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:ProWorks.FlickrXSLTSearch="urn:ProWorks.FlickrXSLTSearch" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ProWorks.FlickrXSLTSearch PS.XSLTsearch ">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="xmlcontent" select="umbraco.library:GetXmlDocumentByUrl('http://plymouthcollege-outdoored.blogspot.com/feeds/posts/default?alt=rss')" />
<xsl:template match="/">
<xsl:apply-templates select="$xmlcontent" />
</xsl:template>
</xsl:stylesheet>
The app pool is being torn down with a stack overflow exception. The feed itself is valid as can be seen here.
Any ideas appreciated.
The issue is with the apply-templates, not the GetXmlDocumentByUrl()
Still looking...
cheers,
doug.
You're right Doug. This does not kill the app pool:
<?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:atom="http://www.w3.org/2005/Atom"
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:ProWorks.FlickrXSLTSearch="urn:ProWorks.FlickrXSLTSearch" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ProWorks.FlickrXSLTSearch PS.XSLTsearch ">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="xmlcontent" select="umbraco.library:GetXmlDocumentByUrl('http://plymouthcollege-outdoored.blogspot.com/feeds/posts/default?alt=rss')" />
<xsl:template match="/">
<xsl:apply-templates select="$xmlcontent/*" />
</xsl:template>
</xsl:stylesheet>
Thanks for the pointer, think it might be shaping up to be one of those days!
Save your self some effort and check out these two excellent resources for consuming rss and atom feeds...
http://dawoe.blogspot.com/2008/03/transforming-feedsone-xslt-to-rule-them.html
http://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/xslt-handling-of-all-rss-versions
A bit of copy-paste and you're done in 5 mins or less!
cheers,
doug.
Hi Simon,
The problem was that when you apply-templates on the XML, the only template that it matched was the match="/" which would cause an infinite loop.
The way you've got it now using "$xmlcontent/*" is fine, as that applies templates to the child node (in this case the root node aka document element).
If you had to apply-templates at the top root, then you could add a "mode"?
Cheers, Lee.
Thanks Lee, school boy error :s
No worries, took me a while to realise what was going on too... Hindsight is a wonderful thing! ;-)
is working on a reply...