Copied to clipboard

Flag this post as spam?

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


  • Jan Vermeerbergen 79 posts 112 karma points
    Oct 29, 2012 @ 23:58
    Jan Vermeerbergen
    0

    Format Twitter 'Created_at' date in XSLT ?

    Hi,

    Is it possible to format the created_at date from a twitter XML stream? 

    I'm currently fetching some tweets in XSLT from this source: 
    https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=false&include_rts=false&screen_name=aftermathematic&count=10

    I can for-each thru all my tweets without a problem, but can't seem to be able to format the date, it just comes up empty then.

    Here's what I have: 
    <xsl:value-of select="umbraco.library:FormatDateTime(./created_at, 'dd.MM.YYYY')"/>


  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Oct 31, 2012 @ 17:41
    Jan Skovgaard
    0

    Hi Jan

    I believe that should be possible. Could you try posting all of the code so we can see the full context please? :)

    Looking forward to hearing from you.

    /Jan

  • Jan Vermeerbergen 79 posts 112 karma points
    Dec 17, 2012 @ 00:50
    Jan Vermeerbergen
    0

    Hi Jan,
    this is my code:

        <xsl:template match="/">
           
            <xsl:variable name="twitterurl">https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=false&amp;include_rts=false&amp;screen_name=xxxxxxx&amp;count=10</xsl:variable>;
           
            <xsl:variable name="tweets" select="document($twitterurl)/statuses/status"/>
           
            <ul id="tweetticker">
               
                <xsl:if test="count(document($twitterurl)/statuses/status) &gt; 0">
                <xsl:for-each select="$tweets">
                   
                    <li>
                        <span><xsl:value-of select="./created_at" disable-output-escaping="yes"/></span>
                        <span><xsl:value-of select="umbraco.library:FormatDateTime(./created_at, 'dd.MM.YYYY')"/></span>
                        <p><xsl:value-of select="./text" disable-output-escaping="yes"/></p>
                    </li>               
                   
                </xsl:for-each>   
                </xsl:if>   
               
            </ul>       
           
        </xsl:template>

     

    still haven't figured out a possibility to format the created_at date....

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Dec 27, 2012 @ 00:47
    Jan Skovgaard
    0

    Hi Jan

    Sorry for the late reply.

    So if you just write out ./created_at without using the FormatDateTime extension around it do you then get anything returned? And if so what is the format like?

    /Jan

  • Charles Afford 1163 posts 1709 karma points
    Jan 03, 2013 @ 22:20
    Charles Afford
    0

    Hello,

    Think i have run into the same thing.  I passed the created_at to javascript, did some work on it and passed it back.  I was then able to render my tweet and some text like "this was posted 5 days ago on the xx of x 20xx".  Hope this helps, will post some code if it is the sort of thing you need :)

Please Sign in or register to post replies

Write your reply to:

Draft