Orbeon:提高 Orbeon 代码的可重用性

发布于 2024-12-27 18:12:40 字数 338 浏览 2 评论 0原文

如果有多个日期字段具有相同的约束或多个文本区域具有相同的约束
是否可以在类似的约束中重用绑定使用的约束?

假设文本区域 1 有约束

if(string-length(.) > 500)
    then substring(.,1,500)
else .

,文本区域 2 有约束,

if(string-length(.) > 500)
    then substring(.,1,500)
else .

是否可以在公共位置具有约束,并在每次绑定时调用特定约束并重用代码?

If there are multiple date fields that have the same constraint or multiple text-area with the same constraint

Is it possible to reuse the constraint used by a bind, across similar constraints?

say text-area 1 has constraint

if(string-length(.) > 500)
    then substring(.,1,500)
else .

and text-area 2 has constraint

if(string-length(.) > 500)
    then substring(.,1,500)
else .

is it possible to have the constraint at a common location and at each bind call the particular constraint and reuse the code?

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

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

发布评论

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

评论(1

不必了 2025-01-03 18:12:40

您可以声明一个 bind,其中 nodeset 表达式指向与两个文本区域相对应的两个节点。例如:(

<bind nodeset="/my-root/(text-area-1 | text-area-2)" constraint="…"/>

将来,定义更像可重用 XPath 表达式的函数的功能可能会添加到 XForms 中,从而允许您在其他情况下轻松重用 XPath 表达式。)

You can declare a single bind where the nodeset expression points to the two nodes corresponding to your two text areas. For instance:

<bind nodeset="/my-root/(text-area-1 | text-area-2)" constraint="…"/>

(In the future, a capability to define functions that are more like reusable XPath expressions might be added to XForms, allowing you to also easily reuse XPath expressions in other situations.)

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