使用 XSLT 处理业务规则?
我的一位同事提到 XSLT 的一个用途是处理业务规则。 他提到,有些系统允许用户以某种文本格式编写业务规则,然后程序使用 XSLT 处理文本并在应用程序运行时应用规则。
有人可以帮我解释一下这个问题吗?
谢谢!
A coworker of mine mentioned that one use of XSLT is processing business rules. He mentioned that there were systems that allowed users to write business rules in some kind of text format, and then the program uses XSLT to process the text and apply the rules at run-time in the application.
Can someone shed some light on this subject for me?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
哎哟。 我不建议这样做。
正如第一响应者所说,XSL-T 是用于转换 XML 的。 它不是规则引擎。 我认为这听起来像是对技术的滥用。
XSL-T 转换的编写并不直观。 如果业务规则的目标之一是允许业务人员更新和维护规则,那么我无法想象还有比 XSL-T 更迟钝和更困难的技术来实现这一目标。
Ouch. I wouldn't recommend that.
As the first responder said, XSL-T is for transforming XML. It's not a rules engine. I think it sounds like a misuse of the technology.
XSL-T transforms are not intuitive to write. If one of your goals for business rules is allowing business folks to update and maintain the rules, I can't imagine a more obtuse and difficult technology for doing so than XSL-T.
我想您的同事指的是 BPEL,即业务流程执行语言。 BPEL 是一种基于 XML 的可执行语言,用于描述业务流程。
作为 XML 格式,可以使用 XSLT 生成或转换业务规则。 但是,我对 BPEL 不熟悉,所以我不知道有任何系统在做类似的事情。
I suppose your colleague was refering to BPEL, the Business Process Execution Language. BPEL is an XML-based executable language for describing business processes.
Being an XML format, business rules may be generated or transformed using XSLT. However, I'm not familiar with BPEL so I don't know any system doing something like that.
是的。 这种有点类似文本的格式被称为 Excel,用户往往用它来做各种复杂的事情。 然后,程序员花费大量时间尝试使用他能找到的每一种闪亮的新技术(包括 XSLT)来处理它,最后决定针对所有不一致之处进行手动编码。 它不是完全自动化的,因为没有理智的用户相信程序员第一次就能做对。
Yes. The somewhat-like text format is called Excel, and users tend to do all kinds of complex things with it. The programmer then spends an awful lot of time trying to process it with every shiny new technology he can find, including XSLT, and finally decides to hand-code around all the inconsistencies. It is not fully automated, as no sane user trusts the programmer to get it right first time.
XSLT 代表 XSL 转换。 它用于将 XML 文档从一种形式更改为另一种形式。
对于系统,Microsoft BizTalk 在映射操作中使用 XSLT,将一个 XML 文档映射到另一个文档。 在 XSLT 中,用户可以利用 .net 代码进行更复杂的处理。
我确信其他人会有更好的解释,但您可以通过 Google 搜索 XSLT 教程轻松找到更多信息。 这是一个很大的话题。
XSLT stands for XSL Transform. It is used to change an XML document from one form to another.
As for systems, Microsoft BizTalk uses XSLT in mapping operations that map one XML document into another. Within the XSLT the user can make use of .net code to do more complex processing.
I'm sure someone else will have a much nicer explanation but you can easily find out more by Googling XSLT tutorials. It's a huge topic.
应该可以:用 XML 编写规则,案例数据也应该用 XML 编写,然后可以编写一个通用的 XSLT,将案例数据与规则进行比较,并以正确的顺序执行相关规则。
业务用户不需要了解XSLT,他们只需要知道如何编写规则即可。
It should be possible: write your rules in XML, the case data should also be in XML, and then a generic XSLT could be written that compares the case data against the rules and executes the relevant rules in the correct sequence.
The business users don't need to know XSLT, they just need to know how to write the rules.