Copied to clipboard

Flag this post as spam?

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


  • Cre8tive 7 posts 27 karma points
    Nov 07, 2012 @ 20:32
    Cre8tive
    0

    Error parsing XSLT file: \xslt\umbfeedViewer.xslt

    I am using uBlogsy for my site's blog and want to be able to use the built in RSS feed to display latest articles on the home page and various other product pages. It's perfect for me because it allows me to use categories, authors and tags to display related posts on the various pages.

    However when I place the FeedViewer macro on the page I get the aforementioned parsing error. It works perfect when I use outside RSS feeds from other sites. It also works perfectly when I pass the feed through FeedBurner first. FeedBurner does not allow me to use the category and tags query string though so that is not a solution.

    On thing I did notice is that when I place the macro in the editor using the internal blog URL that it strips out the domain information ( http://www.mysite.com/ ) and the URL shows only as a relative URL ( /blog/rss/ ).

    I am not yet sure if that is the problem or not. I am looking for other possible causes or solutions.

    Any ideas would be very much appreciated. Here is the umbfeedViewer.xslt.

    --------------------------

     

    <?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:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:variable name="numberOfItems">
      <xsl:choose>
        <xsl:when test="/macro/numberOfItems != ''">
          <xsl:value-of select="/macro/numberOfItems"/>
        </xsl:when>
        <xsl:otherwise>10</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="excerptLength">
      <xsl:choose>
        <xsl:when test="string(/macro/excerptLength) != ''">
          <xsl:value-of select="/macro/excerptLength"/>
        </xsl:when>
        <xsl:otherwise>0</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="feed" select="/macro/feedUrl"/>
    <!-- cache for 30 minutes (1.800 seconds) -->
    <xsl:variable name="cacheRate" select="number(1800)"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
    <xsl:choose>
      <xsl:when test="$feed != ''">
        <xsl:variable name="feedContent" select="umbraco.library:GetXmlDocumentByUrl($feed, number($cacheRate))"/>
        <xsl:choose>
          <xsl:when test="$feedContent != 'error'">
            <xsl:call-template name="renderFeed">
              <xsl:with-param name="feedContent" select="$feedContent"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <p>
              <strong>Feed Viewer Macro Error: Error fetching feed</strong><br />
              The feed '<xsl:value-of select="$feed"/>' could not be loaded. Verify that the feed url exists and that you have an
              active internet connection
            </p>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <p>
          <strong>Feed Viewer Macro Error: No feed chosen</strong><br />
          Please make sure to add a value in the "Feed Url" parameter
        </p>
      </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template name="renderFeed">
    <xsl:param name="feedContent"/>
    <xsl:if test="count($feedContent//item) &gt; 0">

      <!--<ul class="feedList">-->
      
      <xsl:for-each select="$feedContent//item">
        <xsl:if test="position() &lt;= $numberOfItems">
          
           <!-- <li>
            <h4> -->
          
          <h3 class="title"><a href="{link}" target="_blank">
            
            <img src="/media/3434/set10_05.png" alt="Blog Icon" style="margin-right: 10px;" align="left"/>
            
            <xsl:value-of select="title"/></a></h3>
           
          
           <!--</h4>
            <xsl:choose>
              <xsl:when test="string($excerptLength) != '0'">
                <p>
                  <xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(description), number($excerptLength), '...')" disable-output-escaping="yes"/>
                </p>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="description" disable-output-escaping="yes"/>
              </xsl:otherwise>
            </xsl:choose>
          -->
          
            <div> <xsl:value-of select="umbraco.library:LongDate(pubDate)"/></div>
      
          <hr />
            
        </xsl:if>
      </xsl:for-each>
    <!--</ul>-->
    </xsl:if>
    </xsl:template>

    </xsl:stylesheet>

Please Sign in or register to post replies

Write your reply to:

Draft