Collective.xdv 中的 local-name() 支持

发布于 2024-10-31 02:50:51 字数 319 浏览 10 评论 0原文

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

<fb:like></fb:like>

,我试图通过选择其 XPATH

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

但是,我没有看到任何输出。 Collective.xdv 支持上述内容吗?还有另一种方法可以在 XPATH 中选择 fb:like 标签吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何以畏孤独 2024-11-07 02:50:51

lxml 使用的 libxml2 HTMLParser 以及 xdv/diazo 会去除名称空间前缀,因此您应该能够使用“//like”选择它。

您将需要添加一些 xslt 代码来修复这些标签,因为它们必须呈现为才能工作:

<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 编辑器来说很难确保。

劳伦斯

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

霊感 2024-11-07 02:50:51

aiui,这不是本地名称的工作原理。您需要匹配命名空间限定的标记,然后 local-name() 返回非限定名称。我相信 //* 仅返回默认命名空间中的标签节点集。

您尝试过 //fb:like 吗? [我知道,这太简单了 - 我认为这是错误的 - 但话又说回来,它简单:-)]

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 :-) ]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文