AddThis Facebook Like Namespace
This is an open discussion with 13 replies, filed under XSLT.
Search
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:
- Remove the
fb:like:layout
parameter.button_count
is the default value so it’s unneccessary anyways. - 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
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:
<script type="text/javascript"> var addthis_share = { url: "http://www.example.com", title: "Example" } </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.
AddThis adds the following code to create an addthis-button:
But how can I set the namespace for the facebook-like-button?:
Since Symphony throws an XSLT-processing error because of the fb:like:layout-attribute.