Copied to clipboard

Flag this post as spam?

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


  • Robin Hansen 135 posts 368 karma points
    Oct 20, 2010 @ 13:24
    Robin Hansen
    0

    Rss feed from video-tuts not working!

    I'm TOTALLY new to Umbraco but find most of pretty easy - BUT something makes me pull out my hair in frustration! - I've followed this video tutorial(http://umbraco.org/help-and-support/video-tutorials/for-site-builders/more-xslt/setting-up-an-rss-feed) comepletly several times now but something is not right. Seems like it does'nt render dynamical content, only the predefined static content:

    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper">
    <channel>
    <title>My sample rss</title>
    <link>http://localhost</link>;
    <pubDate></pubDate>
    <generator>umbraco</generator>
    <description>Add your description here</description>
    <language>en</language>
    </channel>
    </rss>
  • Bas Schouten 135 posts 233 karma points
    Oct 20, 2010 @ 13:30
    Bas Schouten
    0

    Hi Robin,

    Can you send the full xslt code and your Umbraco version?

    Cheers,

    Bas

     

  • Robin Hansen 135 posts 368 karma points
    Oct 20, 2010 @ 13:33
    Robin Hansen
    0

    Yes - I'm trying... I accedently hitted the 'submit' button too early and posted before I was done... Hang on :-D

  • Robin Hansen 135 posts 368 karma points
    Oct 20, 2010 @ 13:34
    Robin Hansen
    0

    I use Umbraco ver. 4.5.2 and here's my xslt code:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:rssdatehelper="urn:rssdatehelper"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:content="http://purl.org/rss/1.0/modules/content/"
      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:output method="xml" omit-xml-declaration="yes"/>

      <xsl:param name="currentPage"/>

      <!-- Update these variables to modify the feed -->
      <xsl:variable name="RSSNoItems" select="string('10')"/>
      <xsl:variable name="RSSTitle" select="string('My sample rss')"/>
      <xsl:variable name="SiteURL" select="concat(' http://',string(umbraco.library:RequestServerVariables('HTTP_HOST')))"/>
      <xsl:variable name="RSSDescription" select="string('Add your description here')"/>

      <!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
      <xsl:variable name="pubDate">
        <xsl:for-each select="$currentPage/node">
          <xsl:sort select="@createDate" data-type="text" order="descending" />
          <xsl:if test="position() = 1">
            <xsl:value-of select="updateDate" />
          </xsl:if>
        </xsl:for-each>
      </xsl:variable>

      <xsl:template match="/">
        <!-- change the mimetype for the current page to xml -->
        <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>

        <xsl:text disable-output-escaping="yes">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</xsl:text>
        <rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
    >

          <channel>
            <title>
              <xsl:value-of select="$RSSTitle"/>
            </title>
            <link>
              <xsl:value-of select="$SiteURL"/>
            </link>
            <pubDate>
              <xsl:value-of select="$pubDate"/>
            </pubDate>
            <generator>umbraco</generator>
            <description>
              <xsl:value-of select="$RSSDescription"/>
            </description>
            <language>en</language>

            <xsl:apply-templates select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">
              <xsl:sort select="@createDate" order="descending" />
            </xsl:apply-templates>
          </channel>
        </rss>

      </xsl:template>

      <xsl:template match="node">
        <xsl:if test="position() &lt;= $RSSNoItems">
          <item>
            <title>
              <xsl:value-of select="@nodeName"/>
            </title>
            <link>
              <xsl:value-of select="$SiteURL"/>
              <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
            </link>
            <pubDate>
              <xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'r')" />
            </pubDate>
            <guid>
              <xsl:value-of select="$SiteURL"/>
              <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
            </guid>
            <content:encoded>
              <xsl:value-of select="concat('&lt;![CDATA[ ', ./data [@alias='newsTeaser'],']]&gt;')" disable-output-escaping="yes"/>
            </content:encoded>
          </item>
        </xsl:if>
      </xsl:template>

    </xsl:stylesheet>

  • Bas Schouten 135 posts 233 karma points
    Oct 20, 2010 @ 13:45
    Bas Schouten
    0

    Hi Robin,

    This xslt should work.

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rssdatehelper="urn:rssdatehelper"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    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:output method="xml" omit-xml-declaration="yes"/>
     <xsl:param name="currentPage"/>
     <!-- Update these variables to modify the feed -->
     <xsl:variable name="RSSNoItems" select="string('10')"/>
     <xsl:variable name="RSSTitle" select="string('My sample rss')"/>
     <xsl:variable name="SiteURL" select="concat('http://',umbraco.library:RequestServerVariables('HTTP_HOST'))"/>
     <xsl:variable name="RSSDescription" select="string('Add your description here')"/>
     <!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
     <xsl:variable name="pubDate">
      <xsl:for-each select="$currentPage/* [@isDoc]">
       <xsl:sort select="@createDate" data-type="text" order="descending" />
       <xsl:if test="position() = 1">
        <xsl:value-of select="updateDate" />
       </xsl:if>
      </xsl:for-each>
     </xsl:variable>
     <xsl:template match="/">
      <!-- change the mimetype for the current page to xml -->
      <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/>
      <xsl:text disable-output-escaping="yes">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</xsl:text>
      <rss version="2.0"
      xmlns:content="http://purl.org/rss/1.0/modules/content/"
      xmlns:wfw="http://wellformedweb.org/CommentAPI/"
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      >
       <channel>
        <title>
         <xsl:value-of select="$RSSTitle"/>
        </title>
        <link>
         <xsl:value-of select="$SiteURL"/>
        </link>
        <pubDate>
         <xsl:value-of select="$pubDate"/>
        </pubDate>
        <generator>umbraco</generator>
        <description>
         <xsl:value-of select="$RSSDescription"/>
        </description>
        <language>en</language>
        <xsl:apply-templates select="$currentPage/* [@isDoc][string(umbracoNaviHide) != '1']">
         <xsl:sort select="@createDate" order="descending" />
        </xsl:apply-templates>
       </channel>
      </rss>
     </xsl:template>
     <xsl:template match="* [@isDoc]">
      <xsl:if test="position() &lt;= $RSSNoItems">
       <item>
        <title>
         <xsl:value-of select="@nodeName"/>
        </title>
        <link>
         <xsl:value-of select="$SiteURL"/>
         <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
        </link>
        <pubDate>
         <xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'r')" />
        </pubDate>
        <guid>
         <xsl:value-of select="$SiteURL"/>
         <xsl:value-of select="umbraco.library:NiceUrl(@id)"/>
        </guid>
        <content:encoded>
         <xsl:value-of select="concat('&lt;![CDATA[ ', ./bodyText,']]&gt;')" disable-output-escaping="yes"/>
        </content:encoded>
       </item>
      </xsl:if>
     </xsl:template>
    </xsl:stylesheet>

    Cheers,

    Bas

  • Robin Hansen 135 posts 368 karma points
    Oct 20, 2010 @ 14:22
    Robin Hansen
    0

    Thank you very much! I acctually had to replace

    <xsl:for-each select="$currentPage/node">

    with this:

    <xsl:for-each select="$currentPage/* [@isDoc]">

    despite of I downloaded the source code from the tut. page... :-/

     

    Thanks a lot m8, yet again... :-)

  • Bas Schouten 135 posts 233 karma points
    Oct 20, 2010 @ 14:32
    Bas Schouten
    0

    Hi Robin,

    Glad I could help you. Can you mark it as solution please?

    Cheers,

    Bas

Please Sign in or register to post replies

Write your reply to:

Draft