Copied to clipboard

Flag this post as spam?

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


  • Ron Brouwer 273 posts 768 karma points
    Nov 17, 2009 @ 12:42
    Ron Brouwer
    0

    Error parsing XSLT file

    Hi Warren,

    First of all I love this package!
    However at the moment (it did work and no errors occurred) it is causing the well known "Error parsing XSLT file". And I can't find the problem, I know it goes wrong when using CWS.Twitter:, because when I just read directly from xml it works.

    The template that I use:

    <xsl:template match="status" mode="tweet">
        <!-- Change the XHTML here for how you want each tweet to be displayed -->
        <div class="block-content">
          <p>
            <xsl:value-of select="CWS.Twitter:FormatURLS(text)" disable-output-escaping="yes"/>
          </p>
          <small class="note">
            <xsl:value-of select="umbraco.library:FormatDateTime(CWS.Twitter:FormatTwitterDate(created_at), 'ddd d MMM yy @ H:mm')"/> from <xsl:value-of select="source" disable-output-escaping="yes"/>
          </small>
        </div>
      </xsl:template>

    The XML that is feched from Twitter:

    <statuses type="array">
      <status>
        <created_at>Mon Nov 16 18:06:18 +0000 2009</created_at>
        <id>5771338288</id>
        <text>Morgen 17/11 partnervergadering in Convention Factory met info over (promo) activiteiten in 2009 en 2010 en profiteer van Giro en Sail</text>
        <source>web</source>
        <truncated>false</truncated>
        <in_reply_to_status_id />
        <in_reply_to_user_id />
        <favorited>false</favorited>
        <in_reply_to_screen_name />
        <user>
          <id>40857056</id>
          <name>VVV Amsterdam</name>
          <screen_name>ATCB</screen_name>
          <location>Amsterdam</location>
          <description />
          <profile_image_url>http://a1.twimg.com/profile_images/442561770/woordmerk_NL2_normal</profile_image_url>;
          <url>http://www.iamsterdam.com/visiting</url>;
          <protected>false</protected>
          <followers_count>80</followers_count>
          <profile_background_color>709397</profile_background_color>
          <profile_text_color>333333</profile_text_color>
          <profile_link_color>FF3300</profile_link_color>
          <profile_sidebar_fill_color>A0C5C7</profile_sidebar_fill_color>
          <profile_sidebar_border_color>86A4A6</profile_sidebar_border_color>
          <friends_count>1</friends_count>
          <created_at>Mon May 18 11:40:36 +0000 2009</created_at>
          <favourites_count>0</favourites_count>
          <utc_offset>3600</utc_offset>
          <time_zone>Amsterdam</time_zone>
          <profile_background_image_url>http://s.twimg.com/a/1258070043/images/themes/theme6/bg.gif</profile_background_image_url>;
          <profile_background_tile>false</profile_background_tile>
          <statuses_count>96</statuses_count>
          <notifications />
          <geo_enabled>false</geo_enabled>
          <verified>false</verified>
          <following />
        </user>
        <geo />
      </status>
    </statuses>

     

    Any help will be much appriciated!

    Ron

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 17, 2009 @ 14:58
    Chris Houston
    0

    Hi Ron,

    If I understood you correctly this did work and has just stopped working?

    So it's likely to be something different with the current XML received from twitter, have you tried breaking the XSLT down so that it only calls one of Warren's XSLT extensions to see if you only get the error with one of them?

    I assume you have following in the xsl:stylesheet:

    xmlns:CWS.Twitter="urn:CWS.Twitter"

    And in the exclude=result-prefixes:

    CWS.Twitter

    I have currently replaced Warren's function call FormatURLS with the following XSLT template, we are currently working on a new version that will include this within the function, but for now you might wish to do the same.

    I.e. replace:

    <xsl:value-of select="CWS.Twitter:FormatURLS(text)" disable-output-escaping="yes"/>

    with:

    <xsl:call-template name="formaturl">
     <xsl:with-param name="url" select="text"/>
    </xsl:call-template>

    And then add the following xsl:template

       <xsl:template name="formaturl">
    <xsl:param name="url"/>
    <xsl:variable name="transform-http" select="Exslt.ExsltRegularExpressions:replace($url, '(http\:\/\/\S+)',ig,'&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;')"/>
    <xsl:variable name="transform-https" select="Exslt.ExsltRegularExpressions:replace($transform-http, '(HTTps\:\/\/\S+)',ig,'&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;')"/>
    <xsl:variable name="transform-AT" select="Exslt.ExsltRegularExpressions:replace($transform-https, '(^|\s)@(\w+)',ig,' &lt;a href=&quot;http://www.twitter.com/$2&quot;&gt;@$2&lt;/a&gt;')"/>
    <xsl:variable name="transform-HASH" select="Exslt.ExsltRegularExpressions:replace($transform-AT, '(^|\s)#(\w+)',ig,' &lt;a href=&quot;http://www.twitter.com/search?q=$2&quot;&gt;#$2&lt;/a&gt;')"/>
    <xsl:value-of select="$transform-HASH" disable-output-escaping="yes"/>
    </xsl:template>

    Cheers,

    Chris

  • Ron Brouwer 273 posts 768 karma points
    Nov 17, 2009 @ 15:29
    Ron Brouwer
    0

    Thanks for helping out!

    It seems that the xml that is show above won't work for some reason.
    There is no problem when saving the template so all extensions are correct.
    However using FormatURLS or FormatTwitterDate causes the problem.
    I've replaced the FormatURLS like you suggested but it doesn't make any difference.

    Ron

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 17, 2009 @ 17:08
    Warren Buckley
    0

    Hiya Ron,
    Is the DLL definately been copied over and along with the config file updated?

    A quick way to test is to use the built in XSLT editor.

    1. Open the xslt file in umbraco
    2. Use the insert value of button (2nd button, the one to the right of the save xslt button)
    3. Press Get Extension button
    4. From the left hand side in the dropdown CWS.Twitter should be available
    5. Then in the right hand dropdown should be FormatTwitterDate and FormatURLs

    Have you tried without fomatting the date, to see if that is the problem.

    Warren

  • Ron Brouwer 273 posts 768 karma points
    Nov 18, 2009 @ 10:01
    Ron Brouwer
    0

    Thanks Warren,

    I just found the problem.
    One of my colleagues was so good to override the xsltExtensions.config.

    I find it odd though. I never received an error from Umbraco, which it normally does whenever an extension is missing.

    Ron

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 18, 2009 @ 13:11
    Warren Buckley
    0

    Glad you got it fixed :)

  • Ron Brouwer 273 posts 768 karma points
    Nov 18, 2009 @ 17:20
    Ron Brouwer
    0

    Hi Warren,

    Just used your extensions only in a different xslt for a client to correctly display a twitter list of all employees working at that company.
    The xsl and xml is different but it works just fine!

    Ron

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 19, 2009 @ 09:26
    Warren Buckley
    0

    Yeh with it being XML that the beneift of having XSLT to display what data you want back from the XML. But obviously the common one is to show your most recent tweets.

    Warren

Please Sign in or register to post replies

Write your reply to:

Draft