Collective.xdv中对local-name()的支持 [英] local-name() support in Collective.xdv

查看:91
本文介绍了Collective.xdv中对local-name()的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Plone 3.5站点,我正在尝试将Collecting.xdv主题中的内容嵌入Simple Social的FB Like操作. FB Like函数嵌入在XML标记中

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>

我正在尝试通过

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

但是,我没有看到任何输出.以上是否在collective.xdv中受支持?还有另一种方法可以在XPATH中选择fb: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?

推荐答案

lxml使用的libxml2 HTMLParser以及xdv/diazo去除了名称空间前缀,因此您应该能够使用"//like"来选择它.

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

您将需要添加一些xslt代码来修复这些标记,因为必须对其进行渲染才能起作用:

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>

虽然可以使xdv/diazo与XMLParser一起使用,然后您需要确保向文档中添加了xmlns:fb ="..."声明,并且所有输入都是有效的xhtml,这很困难以确保使用基于浏览器的html编辑器.

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.

劳伦斯

这篇关于Collective.xdv中对local-name()的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆