可转换为 Java 和 XSLT 的规则或脚本语言
是否有任何规则或脚本语言存在一个或多个 Java 库可以将其转换为 Java 和 XSLT?
为了转换为 Java,它可以生成 Java 源代码或 java 字节码。它需要易于从 Java 调用并且“轻量级”/高性能。
对于 XSLT...生成函数或模板的等效项或操作传入值并返回结果的内容。
通过转换,我的意思是有人用某种语言(规则/脚本/任何语言)编写代码。然后,我对该代码运行一些“转换”,得到 Java 代码(源代码或字节码)。我对相同的代码运行一些其他“转换”,并获得 XSLT 代码。
由于我猜测 XSLT 情况更难解决,因此这里有一个简化的可能示例:
输入规则/脚本语言:
// Some language psuedocode
output(concat(value1, value2, value3))
输出 XSLT:
<xsl:value-of select="concat($value1, $value2, $value3)"/>
Is there any rule or scripting language out there for which exists one or more Java libraries to convert it to both Java and XSLT?
For converting to Java, it can either generate Java source, or java bytecode. It needs to be easy to call from Java and "lightweight"/high performance.
For XSLT... generating the equivalent of a function or template or something that manipulates values coming in and returns a result.
By conversion, I mean someone writes code in some language (rule/script/whatever). I then run some "conversion" on that code and I get Java code (source or bytecode). I run some other "conversion" on that same code and I get XSLT code.
Since I'm guessing the XSLT case is the more difficult to solve, here's a simplified possible example:
Input rule/script language:
// Some language psuedocode
output(concat(value1, value2, value3))
Output XSLT:
<xsl:value-of select="concat($value1, $value2, $value3)"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Groovy 浮现在脑海中,如果您愿意,您实际上可以输入 java,或者使用它们更有效的语法。
它还被扩展到 Grails,它实际上是 Groovy on Rails。 SpringSource 支持这两者,并且具有高性能和轻量级的特点。它们将编译为 Java 字节码。
有一个关于使用 Groovy 与 XSLT 的链接,您提到您想要“转换” XSTL 的脚本,不确定你在这里的意思,但你当然可以将 XSLT 与 groovy 一起使用。
如果您需要创建某种模板来生成 java 代码、html、文本、电子表格以及几乎任何内容,Apache Velocity 这是一种模板语言/引擎,用于引用 java 代码中定义的对象。
BeanShell 是另一种,语法就像 java 一样,它是一种脚本语言,根据我的经验,你可以做任何事情在java中你可以在BeanShell中做。
Groovy comes to mind, you can actually type java if you want, or use their much more efficient syntax.
It's also been extended to Grails which is Groovy on Rails effectively. SpringSource backs both and are high performance and light weight. They will compile to Java byte-code.
There is this link about using Groovy with XSLT you mention you want to "convert" the script to XSTL, not sure what you mean here but you can certainly use XSLT with groovy.
If you need to create some sort of template to generate java code, html, text, spreadsheets, almost anything there is Apache Velocity which is a templating language / engine to reference objects defined in java code.
BeanShell is an other one, the syntax is just like java it's a scripting language and in my experience anything you can do in java you can do in BeanShell.
您始终可以尝试使用 antlr 并实现您自己的解析器/转换器。
You can always try to use antlr and implement your own parser/converter.
Xalan XSLTC 支持将 xslt 编译为 java 字节码,因此如果 xslt 符合您的定义脚本语言是有可能的。 xslt 的编译只是身份转换:)
Xalan XSLTC supports compiling xslt to java bytecode, so if xslt conforms to your definition of scripting language that would be a possibility. The compilation to xslt would just be the identity transformation :)