3

I have a Plone 3.5 site and I am trying to embedded Simple Social's FB Like action for a content in a collective.xdv theme. The FB Like function is embedded in an XML tag

<fb:like></fb:like>

I am trying to select its XPATH via

//*[local-name()="like"]

However, I do not see any output. Is the above supported in collective.xdv? Is there another way to select the fb:like tag in XPATH?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
h2o
  • 513
  • 2
  • 8

2 Answers2

2

The libxml2 HTMLParser used by lxml and thus xdv/diazo strips namespace prefixes, so you should be able to select it with "//like".

You will need to add some xslt code to fix up those tags, as they must be rendered as in order to work:

<xsl:template match="activity|add-profile-tab|bookmark|comments|friendpile|like|like-box|live-stream|login-button|pronoun|recommendations|serverFbml|profile-pic|user-status">
  <xsl:element name="fb:{local-name()}" xmlns:fb="http://www.facebook.com/2008/fbml">
    <xsl:apply-templates select="@*|node()"/>
  </xsl:element>
</xsl:template>

While xdv/diazo could be made to work with the XMLParser you would then need to ensure that you added an xmlns:fb="..." declaration to your document and that all your input was valid xhtml, which is difficult to ensure with browser based html editors.

Laurence

Laurence Rowe
  • 2,909
  • 17
  • 20
  • 1
    Thanks. This works and I get the missing elements here tags with their attributes. However, its child elements are missing. I suspect its a different issue now and it may have something to do with the product's javascript requirement. It works with the default theme. – h2o Apr 09 '11 at 08:45
  • Hi @h2o! Did you succeed getting the children? Would you accept the answer as correct and open up a new question? – Davi Lima Apr 11 '12 at 13:14
0

aiui, that's not how local-name works. You need to match on a namespace-qualified tag, and then local-name() returns the unqualified name. I believe //* is only returning a nodeset of tags in the default namespace.

Have you tried //fb:like? [I know, that's far too easy - and I think it's wrong - but then again, it is easy :-) ]

Auspex
  • 2,175
  • 15
  • 35
  • I don't know if it is correct because if I use it, collective.xdv breaks the theme. If I select its parent node, I just get an empty tag. – h2o Apr 08 '11 at 13:49