Copied to clipboard

Flag this post as spam?

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


  • Kalle Wibeck 504 posts 27 karma points
    Mar 22, 2010 @ 13:24
    Kalle Wibeck
    0

    getXMLDocument won't display any content...

    Hi all!

    Kalle's back for a question, after over a year away from the community ;(...

    I'm trying to create a page that lists our uploaded YouTube videos.

    I've installed Darren's great FeedCache and tries to list the containing video clips using XSLT and getXmlDocument() by it just doesn't work...

    I can print all text within the XML file but I just can't iterate the nodes within in anyway!?

    I've tried everything in the RSS guide/tutorial but I'm starting to believe something's broken here...

    The result is the same if I use the getXMLDocumentByUrl() method...

    Server: Windows 2008 x64 / IIS7
    Umbraco: v 4.0.3 (Assembly version: 1.0.3625.27276)

    This is my XSLT:

    <xsl:template match="/">

    <xsl:variable name="xmlDoc" select="umbraco.library:GetXmlDocument( $xmlPath, 0 )" />

    <!--
      ## This line prints the entire XML feed but without any elements, just the text? ##
      -->
    <xsl:value-of select="$xmlDoc" disable-output-escaping="yes" />

    <!-- Iterate through the xml doc -->
    <xsl:for-each select="msxsl:node-set($xmlDoc)/feed/entry" >
    Here should a new entry appear but only work for the entire Doc???
    <xsl:value-of select="title" />
    </xsl:for-each>

    </xsl:template>

    The downloaded / cached YouTube feed has this structure:

    <feed>
    <entry>
    <id>http://gdata.youtube.com/feeds/api/videos/iJErb0gUkyA</id>;
    <published>2010-03-19T07:36:32.000Z</published>
    <updated>2010-03-19T07:56:53.000Z</updated>
    <title type="text">Specialfälgars nyheter våren 2010 - Bildspel med piano</title>
    [SNIP....]
    </entry>
    </feed>

     

    Any suggestions would be much appreciated couse I'm totally stuck on this one....

    // ; ) Kalle

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 22, 2010 @ 13:32
    Lee Kelleher
    2

    Hi Kalle,

    It might be a namespace issue?  The YouTube feeds are using Atom? Have you added that to the namespaces in your XSLT?

    Then try using the atom: prefix on the element names. i.e.

    <xsl:for-each select="$xmlDoc/atom:feed/atom:entry">

    Let us know how it goes.

    Good luck, Lee.

  • Kalle Wibeck 504 posts 27 karma points
    Mar 22, 2010 @ 13:56
    Kalle Wibeck
    1

    Hi Lee!

    I guess I was home sick from the XML-course the entire day of namespaces... ; )

    Your guess was absolutely spot-on - it was a namespace issue and now it work perfect!

    OMG why didn't I ask the worlds greatest community earlier...

    Guess I'll have to write a YouTube feed article now...

    Thanks a lot man!

    // Kalle

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 22, 2010 @ 14:10
    Lee Kelleher
    0

    No worries Kalle.  I ran into the atom namespace problem a few weeks ago - drove me crazy! :-)

    Welcome back to the community!

    Cheers, Lee.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 22, 2010 @ 14:15
    Douglas Robar
    0

    Hi, Kalle!

    So nice to hear from you again!! Will you be coming to CG10?

    Lee has obviously solved your problem. I had a similar issue two weeks ago and spent about 4 hours before I slapped my forehead and figured it out. So don't feel bad... we're all running into namespace issues recently.

    This old post might be helpful just the same: http://dawoe.blogspot.com/2008/03/transforming-feedsone-xslt-to-rule-them.html

    cheers, and welcome back,
    doug.

  • Kalle Wibeck 504 posts 27 karma points
    Mar 22, 2010 @ 15:39
    Kalle Wibeck
    0

    Thanks to you both!

    @Lee: That's the beauty of a community; - Someone alse has probably had your problem before you ran into it ; )

    @Doug: I will probably not come to CG10, but things might change - I want to but can't seeem to find the time... Thanks for the link might be in handy any day now, will solve most of my NS issues in the future... ; )

     

    // Kalle

  • Kalle Wibeck 504 posts 27 karma points
    Mar 22, 2010 @ 15:41
    Kalle Wibeck
    0

    BTW, I don't have any karma - can't give you thumbs up...sorry   :,(

    // Kalle

  • Tom 713 posts 954 karma points
    Apr 02, 2011 @ 10:03
    Tom
    0

    Hi Kalle,

    just wondering if you ever finished writing the macro to display your feed list?

    I'd love to have a look if you wouldn't mind? Im trying to do the same thing..

    Cheers,

    Tom

Please Sign in or register to post replies

Write your reply to:

Draft