Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Oct 19, 2011 @ 11:12
    Simon Dingley
    0

    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 "&#x00A0;"> ]>
    <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.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 19, 2011 @ 11:23
    Douglas Robar
    1

    The issue is with the apply-templates, not the GetXmlDocumentByUrl()

    Still looking...

    cheers,
    doug. 

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Oct 19, 2011 @ 11:29
    Simon Dingley
    0

    You're right Doug. This does not kill the app pool:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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!

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 19, 2011 @ 11:31
    Douglas Robar
    1

    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.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 19, 2011 @ 11:36
    Lee Kelleher
    1

    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"?

    <xsl:template match="/">
        <xsl:apply-templates select="$xmlcontent" mode="rss" />
    </xsl:template>
    
    <xsl:template match="/rss" mode="rss">
        <xsl:value-of select="name()"/>
    </xsl:template>

    Cheers, Lee.

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Oct 19, 2011 @ 11:37
    Simon Dingley
    0

    Thanks Lee, school boy error :s

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 19, 2011 @ 11:41
    Lee Kelleher
    0

    No worries, took me a while to realise what was going on too... Hindsight is a wonderful thing! ;-)

Please Sign in or register to post replies

Write your reply to:

Draft