与 xml+xslt 完美搭配的最佳 Java Web 应用程序框架是什么?
我最近了解了一些关于 xml/xslt 的知识,并想在我的 Web 项目中尝试一下.你会为此推荐什么框架?基本上,我想生成一个动态 xml,它将应用于客户端的 xslt 样式表.
I recently learned a bit about xml/xslt and would like to try it in my web project. What framework would you recommend for that? Basically, I want to generate a dynamic xml that will be applied to xslt stylesheet on the client side.
Wicket 是我的第一个候选人,但它主要以 html 为中心.我的想法还没有实现.
Wicket was my first candidate, but it is primarily html-centric. Didn't manage to get my idea work yet.
推荐答案
如果您希望在客户端将 XSLT 样式表应用于从服务器接收的 XML(与您所写的相反 :)),您只需要使用
If you want XSLT stylesheets to be applied on the client-side to XMLs received from server (not opposite as you've written :)) you just have to return pure XML to the client with
<?xml-stylesheet ... ?>
构造嵌入.
如果您想在服务器端将 XSLT 应用于 XML 并将 HTML 返回给客户端 - 请不要打扰.我们在 21 世纪的早期就经历过这种情况——它不是非常可维护的解决方案,而且很难调试.但如果你想要(服务器端解决方案),我也推荐 SpringMVC 的 XLST 视图.还有 classic 和名为 Cocoon 的核心解决方案,它实现了 XML 管道 - 这很好从架构的角度来看,但在实际项目中确实很难使用,经典的 MVC 更适合.
If you want to apply XSLTs to XMLs at server-side and return HTML to client - please dont' bother. We've been through this in very early years of XXI century - it's not very maintainable solution and very hard to debug. But if you want that (server-side solution), I also recommend SpringMVC's XLST view. There's also classic and hard-core solution called Cocoon which implements XML pipieline - it's nice from architectural point of view, but it's really hard to use in real projects, were classic MVC is more suitable.
相关文章