Copied to clipboard

Flag this post as spam?

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


  • JacoboPolavieja 62 posts 84 karma points
    Aug 03, 2010 @ 17:57
    JacoboPolavieja
    0

    RSS feed not displaying nodes

    Hello...

    Just when I thought I was getting it with XSLT, a simple thing slaps me in the face again, haha!

    I  followed the video on umbraco.tv t set up a RSS Feed. It all seems to be ok, but when I finally try to access teh page of the rss it displays the title, the description... but no node. The code is below and I have tried wih all the commented "for-each", but I can't find why it seem like no being able to get the nodes... it's the same expression I use on many other XSLTs through my page:

    <?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" xmlns:tags="urn:tags"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tags ">


      <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('50')"/>
      <xsl:variable name="RSSTitle" select="string('The Hoops Market')"/>
      <xsl:variable name="SiteURL" select="concat(' http://',string(umbraco.library:RequestServerVariables('HTTP_HOST')))"/>
      <xsl:variable name="RSSDescription" select="string('All around the orange ball')"/>
        
      <xsl:variable name="documentTypeAlias" select="string('thm_new')"/>    

      <!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed -->
      <xsl:variable name="pubDate">
        <!-- <xsl:apply-templates select="$currentPage/* [@isDoc]"> -->    
        <!-- <xsl:apply-templates select="$currentPage/* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']"> -->
        <xsl:for-each select="$currentPage/*">
          <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/*">
            <!-- <xsl:apply-templates select="$currentPage/* [@isDoc]"> -->
            <!-- <xsl:apply-templates select="$currentPage/* [name() = $documentTypeAlias and string(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"/>
              <!-- <xsl:value-of select="thm_new_heading"/> -->
            </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[ ', ./thm_new_bodyText,']]&gt;')" disable-output-escaping="yes"/>
            </content:encoded>
          </item>
        </xsl:if>
      </xsl:template>

    </xsl:stylesheet>

    It has to be something simple... but can't get what it might be as the paths seem ok and they're used throughout several other XSLTs. Any idea?

    Thanks!

  • JacoboPolavieja 62 posts 84 karma points
    Aug 03, 2010 @ 18:15
    JacoboPolavieja
    0

    Hmmm... sorry for not looking at it earlier but viewing the source code of the generated rss page it seems like the content is there, but is not displayed in the typical manner...

    Source code:

    <?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>The Hoops Market</title><link> http://localhost</link><pubDate></pubDate><generator>umbraco</generator><description>All around the orange ball</description><language>en</language>Shaq wants the moneyShaquille O'neal is asking for $8million per season in a two years contract to all the teams interested in him.
    &lt;p&gt;body for shaq&lt;/p&gt;
    Shaquille O'Neal,Cleveland Cavaliers,NBA,Atlanta Hawks,Orlando Magic,New York Knicks1USACP3 heading NY?Chris Paul could be trying to force a move to the New York Knicks to start building the so mentioned Big Three
    &lt;p&gt;body for CP3 to NY&lt;/p&gt;
    NBA,New York Knicks,Chris Paul,New Orleans Hornets1USAMensah-Bonsu to AustraliaBirtish player Pops Mensah-Bonsu will finally play in the Australian league&lt;p&gt;body mensah-bonsu&lt;/p&gt;
    Pops Mensah-Bonsu,NBA0FranceJianlian in for ChinaYi Jianlian will be with China for the World Championship
    &lt;p&gt;body&lt;/p&gt;
    Yi Jianlian,New Jersey Nets,World Championship,NBA0ChinaChina to build biggest stadium everRumours say China would be planning the construction of the world's biggest basketball stadium which would have a capacity around the Cowboy Stadium where the NBA All Star weekened was held this year
    &lt;p&gt;Body for China to biuld..&lt;/p&gt;
    Chinese,Stadium,Yao Ming0ChinaMotiejunas staying in Europe?The number 5 Draft Pick this year might stay in Italy for another year according to his father
    &lt;p&gt;body for Motiejunas staying in Europe&lt;/p&gt;
    NBA,Lega,NBA Draft,Donatas Motiejunas0ItalySergio Rodriguez to play in MadridAnother Spanish leaving the NBA.. Sergio has agreed to a deal with Real Madrid
    &lt;p&gt;body for Sergio Rodriguez to play in Madrid&lt;/p&gt;
    Spain,Real Madrid,Spain's National Team,Sergio Rodriguez,New York Knicks0SpainKD to the World ChampKevind Durant will be one of the USA National Team players to stay in Turkey this summer. Derrick Rose and others may follow
    &lt;p&gt;BodyText for KD to WC&lt;/p&gt;
    Kevin Durant,World Championship,USA National Team,Derrick Rose,NBA,LeBron James0USADavid Lee to GSWThe NYK have made a sign&amp;trade sending David Lee to GSW in exchange of Anthony Randolph, Kelenna Azubuike
    &lt;p&gt;Body for David Lee to GSW&lt;/p&gt;
    Golden State Warriors,NBA,New York Knicks,David Lee,Anthony Randolph,Kelenna Azubuike,Ronny Turiaf,LeBron James0USANBA Summer League: Wall owns itJohn Wall didn't deceipt and he finished the Summer League as the best of the classNBA,Summer League,John Wall,Washington Wizards,NBA Draft 2010,LeBron James1USASergio Scariolo to train Armani JeansAccording to several sources, Sergio Scariolo will train italian Lega club Armani Jeans next season
    &lt;p&gt;Body for Sergio Scariolo to Armani&lt;/p&gt;
    Sergio Scariolo,Armani Jeans,Lega,Spain's National Team1ItalySpainLeandro Barbosa to come back homeAfter a successful carrer in the NBA, Leandro Barbosa thinks it's time to retire in his country.
    &lt;p&gt;body for Leandro Barbosa&lt;/p&gt;
    Phoenix Suns,Leandro Barbosa,NBA1BrazilUSAYao Ming: "I won't play for China this time"Although all the pressure from his government, Yao won't play for China in this summer's WC.
    &lt;p&gt;Body for Yao's&lt;/p&gt;
    NBA,Houston Rockets,Chinese,Yao Ming,LeBron James1ChinaBlake Griffin is back!No one doubted it, but Blake Griffin is fully recovered and has his sight on next's years ROY.
    &lt;p&gt;BodyText for Blake&lt;/p&gt;
    Blake Griffin,Los Angeles Clippers,NBA,LeBron James1USANational economy puts Greek clubs in dangerGreece's economic crysis may make things more difficult for its professional sports clubs.
    &lt;p&gt;Full body text of Greek clubs in red numbers&lt;/p&gt;
    Europe,FIBA,Panathinaikos,Josh Childress1GreeceIt's Official: LeBron James To The Knicks!As the Knicks have made it official through their web page, LBJ finally becomes a Knickerbocker
    &lt;p&gt;This is the body of the newwww&lt;/p&gt;

    &lt;p&gt;&amp;nbsp;&lt;/p&gt;

    &lt;p&gt;Lebroooooon!!asd &lt;strong&gt;asdasd&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;

    &lt;p&gt;asd&lt;/p&gt;
    LeBron James,New York Knicks,NBA,Cleveland Cavaliers0USA</channel></rss>

    It seems like it is outputting the "<" and ">" sign incorrectly as "&lt;" and "&gt;"... Weird? Why can't I get on well with XSLT? :). Thanks!

  • Eran Meir 401 posts 543 karma points
    Aug 04, 2010 @ 12:21
    Eran Meir
    0

    i'm having the same problem, did you manage to solve it ?

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Aug 04, 2010 @ 12:37
    Chriztian Steinmeier
    0

    Hi,

    It looks like there's an XSLT file that wasn't fully converted to the 4.5 XML format - the "node" template will never be instantiated...

    Change

    <xsl:template match="node">

    to

    <xsl:template match="*[@isDoc]">

    - and possibly re-enable the *[@isDoc] predicate on the apply-templates instruction, too.

    and see if something better happens... 

    /Chriztian

  • Eran Meir 401 posts 543 karma points
    Aug 04, 2010 @ 12:44
    Eran Meir
    0

    it's going through the nodes but i'm getting the same repsonse as Jacobo, many &lt; and &gt;

  • JacoboPolavieja 62 posts 84 karma points
    Aug 07, 2010 @ 13:11
    JacoboPolavieja
    0

    Thanks a lot Chriztian, that really did the trick!

     

    Eran, didn't you manage to solve it with Chriztian's solution? I just had to change the "match" as he said on the XSLT.

     

    Thanks again! Cheers!

  • Eran Meir 401 posts 543 karma points
    Aug 07, 2010 @ 14:11
    Eran Meir
    0

    ok, it's working now :)

    thank you ! don't know why it wasn't working before

Please Sign in or register to post replies

Write your reply to:

Draft