本文介绍了OS X上的xslt 2.0和Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对XSLT 2.0工作表解析XML文档.但是,有人告诉我OSX 10.5.x上的库仅支持XSLT 1.0操作.当我看xsltproc时,得到的是:

I am attempting to parse an XML document against an XSLT 2.0 sheet. However, I am being told that the libraries on OSX 10.5.x only support XSLT 1.0 operations. When I look at xsltproc, I get this:

hmasing $ xsltproc --version使用libxml 20616,libxslt 10112和libexslt 810针对libxml 20616,libxslt 10112和libexslt 810编译了xsltproclibxslt 10112是针对libxml 20616编译的libexslt 810是针对libxml 20616编译的

hmasing$ xsltproc --versionUsing libxml 20616, libxslt 10112 and libexslt 810xsltproc was compiled against libxml 20616, libxslt 10112 and libexslt 810libxslt 10112 was compiled against libxml 20616libexslt 810 was compiled against libxml 20616

是否有人有安装XSLT 2.0的简明指南,可与这些lib配合使用的ruby xslt宝石,以及一些可以帮助我解决问题的方法?请以我为指导的白痴.任何帮助,我们将不胜感激!

Does anyone have a concise guide to installing XSLT 2.0, the ruby xslt gems to work against those libs, and some good fu to pass my way? Please assume I am a total idiot in any instructions. Any help is greatly appreciated!

  • 汉斯

推荐答案

可悲的是,Saxon是镇上唯一具有免费XSLT 2.0实现的游戏.撒克逊人本身就是杰出的,但它仅是Java或.NET,这意味着所有这些.

Sadly, Saxon is the only game in town with a free XSLT 2.0 implementation. Saxon itself is brilliant, but it is Java or .NET only, with all that that implies.

从命令行或通过系统调用调用它每次都会导致JVM启动成本,因此您可能不想这样做.

Invoking it from the command line or via a system call will incur a JVM startup cost every time, so you probably don't want to do that.

您可以尝试一些操作:

1)您确定需要XSLT 2.0吗?除非您使用的不是1.0中的功能,否则您的XSLT可能与1.0兼容.然后,您可以使用xsltproc.如果您需要的是EXSLT,则xsltproc对此提供了一些支持.

1) Are you sure you need XSLT 2.0? Unless you're using functionality that isn't in 1.0, your XSLT might be 1.0-compatible. Then you could use xsltproc. If what you need is in EXSLT, xsltproc has some support for that.

2)如果您确实需要2.0,则需要为saxon创建某种包装.在很大程度上取决于您要在其中使用的环境,因此这可能是Web服务或类似的东西.对于我正在从事的项目,我们使用一个包装了saxon的小TCP侦听器程序.您可以在这里看到它: http://idp.atlantides.org/svn/idp/idp.contenttool/trunk/epiduke_saxon/对于命令行批处理转换效果很好,而且速度很快.

2) If you definitely need 2.0, then you'll want to create some sort of wrapper for saxon. A lot depends on what environment you want to use this in, so this might be a web service or something like that. For a project I work on, we use a little TCP listener program that wraps saxon. You can see it here: http://idp.atlantides.org/svn/idp/idp.contenttool/trunk/epiduke_saxon/ It works well for command-line batch transforms, and is very fast.

这篇关于OS X上的xslt 2.0和Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:55