Search

AddThis adds the following code to create an addthis-button:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
    <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
    <a class="addthis_button_tweet"></a>
    <a class="addthis_counter addthis_pill_style"></a>
</div>
&lt;script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4d62375c51f7d75e">&lt;/script>
<!-- AddThis Button END -->

But how can I set the namespace for the facebook-like-button?:

<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>

Since Symphony throws an XSLT-processing error because of the fb:like:layout-attribute.

You have to declare the namespace in the stylesheet element:

<?xml version='1.0' encoding="windows-1252"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
   xmlns:fb="http://www.facebook.com/2008/fbml">

...

But then I get the error:

Failed to parse QName 'fb:like:'

This is probably because the namespace isn’t fb, but fb:like:layout.

Try add extension-element-prefixes attribute, see what that gives you…

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
   xmlns:fb="http://www.facebook.com/2008/fbml"
    extension-element-prefixes="fb">

I can’t find the specific spec, but I doubt a ‘:’ is a valid character within a namespace prefix, since it’s used as the delimiter between the prefix and the local name. The xml parser wouldn’t know when your prefix ends and the local name begins. I imagine it would count characters before the first (‘fb’) as the namespace prefix, then the rest ‘like:layout’ as the local name, which I think is invalid.

I know one solution and one idea you could try:

  1. Remove the fb:like:layout parameter. button_count is the default value so it’s unneccessary anyways.
  2. Remove it and add another element: <fb:like layout="button_count" />. I found some people doing that on Google. No idea if it really works though…

when you set up the like button there should be two code options, use the iFrame one instead of the fb:like one. No modification to your page needed.

but iframes are nasty, like herpes.

but iframes are nasty, like herpes.

LOL

Here’s something on how to use the Like Button in XSLT via the Facebook developers forum.

@kanduvisla, I think this will answer your question about using the AddThis service with XSLT.

rofl I agree. but in this case it’s a lot easier.

Hey y’all. I built a quick little utility allowing you to add a Facebook Like button to your site. I don’t know if this will be a help or not.

http://www.addthis.com/forum/viewtopic.php?f=3&t=24946

You can use js to declare the url to be shared like this:

&lt;script type="text/javascript">
var addthis_share = {
  url: "http://www.example.com",
  title: "Example"
}
&lt;/script>

I just stumbled across this topic and thought I would share my solution:

<xsl:text disable-output-escaping="yes"><![CDATA[ <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>]]></xsl:text>

This works for me!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details