如何在 Umbraco 中使用 Exslt.dyn(尤其是“评估”方法)?
我正在尝试执行 XSL 变量中包含的字符串。
Umbraco 有几个 Exslt 片段的钩子,但 Exslt.dyn (Exslt.dynamic) 似乎不是其中之一。
怎么添加进去呢?可接受的方法(按优先顺序排列:
- 编写您自己的 XSLT 扩展(可能使用 Exslt Dynamic 的现有 Umbraco 代码)。
- 从 http://www.exslt.org/dyn/functions/evaluate/index.html 到 Umbraco 中。
- 修改 Umbraco 源以添加它(可能使用 Exslt 的现有 Umbraco 代码) 。
我提到 Exslt Dyanmic 的原因是因为一些 Umbraco XSLT 源代码显示了我假设在源代码中存在的引用(例如:粘贴在此处的 XSL 源代码) http://our.umbraco.org/projects/starter-kits/business-website-starter-pack/general-%28bugs,-feedback,-feature -requests%29/8085-将第一天更改为外汇星期一)
I am trying to execute the string contained in an XSL variable.
Umbraco has hooks for several Exslt pieces, but it seems the Exslt.dyn (Exslt.dynamic) is not one of them.
How do you add it in? Acceptable methods (in order of preference:
- Writing your own XSLT extension (possibly using existing Umbraco code for Exslt Dynamic).
- Uploading the XSL from http://www.exslt.org/dyn/functions/evaluate/index.html into Umbraco.
- Modifying the Umbraco source to add it (possibly using existing Umbraco code for Exslt Dynamic).
The reason I mention Exslt Dyanmic is because some Umbraco XSLT sources show a reference that I am assuming existing in some versions of Umbraco. I cannot find it in the source code, however. (Example: the XSL sources pasted in here: http://our.umbraco.org/projects/starter-kits/business-website-starter-pack/general-%28bugs,-feedback,-feature-requests%29/8085-Changing-the-first-day-to-fx-monday)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很少有 XSLT 处理器实现
dyn:evaluate()
,而 Umbraco 显然不使用其中之一。在这种情况下你无能为力。
要求 Umbraco 开发人员将来合并 XSLT 2.0 处理器 -- XSLT 2.0 有一个本机
指令,用于定义可在任何 XPath 表达式中引用的函数。Very few XSLT processors implement
dyn:evaluate()
and Umbraco obviously doesn't use one of these.There isn't anything you can do in this case.
Ask the Umbraco developers to incorporate an XSLT 2.0 processor in the future -- XSLT 2.0 has a native
<xsl:function>
instruction for defining functions that can be referenced in any XPath expression.不确定这是否有效,但如果 XSLT 的 .Net 实现中开箱即用地支持 Exslt.ExsltDynamic,那么这应该有效。在样式表中添加名称空间 xmlns:Exslt.ExsltDynamic="urn:Exslt.ExsltDynamic" (如您链接的示例中所示),并在 except-result-prefixes 属性中添加 Exslt.ExsltDynamic 以使其在 xslt 文件中可访问。
然后你就可以像在模板中那样做一些事情。
Not sure if this will work, but if Exslt.ExsltDynamic is supported out of the box in the .Net implementation of XSLT, this should work. In your stylesheet add the namespace xmlns:Exslt.ExsltDynamic="urn:Exslt.ExsltDynamic" (as in the example you linked) and in the exclude-result-prefixes property add Exslt.ExsltDynamic to make it accessible in your xslt file.
Then you can just do something like in your template.