在 Android 智能手机和/或平板电脑上运行 XSLT 脚本
我有一个相对简单的问题: 是否可以在 Android 设备上运行 xslt 脚本?我有一个 .xml 文件,使用 .xsl 脚本创建一个新的 .xml 文件。 在 Windows 上,我使用 saxon,它效果很好,但由于我不能总是访问它,所以我更喜欢在我的 Android 手机和/或 Android 平板电脑上运行脚本。
我在谷歌和这个网站上做了一些研究,但我没有找到任何明确的答案。
预先感谢和问候
I have a relatively simple question:
Is there a possibility to run an xslt-script on an android device? I have an .xml file, using a .xsl script to create a new .xml file.
On windows I am using saxon, which works good, but as I don´t have always access to it I would prefer to run a script on my android phone and/or android tablet.
I did some research with google and also on this site, but i didn´t found any clear answer.
thanks in advance and greetings
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在找到了一种从 Android 命令行终端运行 Saxon-JS 2 或更确切地说其命令行工具 xslt3 以及 Saxon HE Java 的方法。
我安装了 Termux,我不得不使用 F-Droid 的版本,因为 Google Play 商店上的版本似乎不再受支持,然后在 Termux 终端 shell 中我安装了 Node 和 java(尝试使用例如 ˋnodeˋ 运行,它会告诉你 ˋpkg install ...ˋ 命令行来安装,然后我做了例如 ˋnpm install -g xslt3ˋ 来安装 Saxon-JS 的命令行工具并下载了 Saxon HE使用 wget 从 Sourceforge 获取 11.2 Java zip 并将其解压缩,最后我能够运行例如
xslt3
来运行 Saxon-JS 或java -jar path-to-saxon11jar
来运行 XSLT 3(或者在 Saxon Java 的情况下,当然还有 XQuery。与 Android 文件系统其余部分的交互有点复杂,但 Linux 终端 shell 有自己的文件系统,带有一个
storage
文件夹,其中的子文件夹(例如storage/download
)链接到其他 Android 应用程序(例如您的浏览器)使用的常用download
文件夹。这是一个屏幕截图。我的 Android 平板电脑上的 Termux 显示了 Saxon HE 11 Java 和 Saxon-JS 2 的执行情况: 。
事实证明,相同的过程在我的 Android 手机上运行得不太好,该手机运行的是 Android 12,因此 Saxon HE 11 或任何其他 Saxon Java HE 目前由于已知问题而无法运行 https://github.com/termux/termux-packages/issues/7332。但 Node.js 和 npm 以及带有
xslt3
的 Saxon-JS 在该手机上运行良好。I have now found a way to run both Saxon-JS 2 or rather its command line tool xslt3 as well as Saxon HE Java from a command line terminal for Android.
I installed Termux, I had to use the version from F-Droid, as the one on the Google play store seems to be no longer supported, then in the Termux terminal shell I installed node and java (try to run with e.g. ˋnodeˋ and it will tell you the ˋpkg install ...ˋ command line to install, then I did e.g. ˋnpm install -g xslt3ˋ to install Saxon-JS's command line tool and downloaded the Saxon HE 11.2 Java zip from Sourceforge with wget and unzipped it and finally I am able to run e.g.
xslt3
to run Saxon-JS orjava -jar path-to-saxon11jar
to run XSLT 3 (or in the case of Saxon Java of course XQuery too.The interaction with the rest of the Android file system is a bit complicated to find out but the Linux Terminal shell has its own file system with a
storage
folder with sub folders likestorage/download
linked to the usualdownload
folder other Android apps (e.g. your browser) use.Here is a screenshot of Termux on my Android tablet showing the execution of Saxon HE 11 Java and Saxon-JS 2: .
It turns out the same procedure doesn't work quite as well on my Android phone which has Android 12 as the running Java and therefore Saxon HE 11 or any other Saxon Java HE currently does not work due to a known issue https://github.com/termux/termux-packages/issues/7332. But Node.js and npm and therefore Saxon-JS with
xslt3
run fine on that phone.