使用Javascript / JQuery进行XML / XSL转换 [英] XML/XSL transform using Javascript/JQuery
问题描述
有人能告诉我是否有办法在客户端使用Javascript或JQuery进行XML / XSLT转换,这种方式适用于所有主流浏览器? (Chrome,Safari,Firefox和IE)?谢谢。
Can anyone tell me if there is a way to do an XML/XSLT transformation on the client side using Javascript or JQuery, a way that works in all major browsers? (Chrome, Safari, Firefox and IE)? Thanks.
推荐答案
我应该从一开始就说我写了这个脚本,但如果你想做一些转换并将一些参数传递给您的XSLT(没什么太花哨的),然后您可以尝试 Magic XML 。
I should state from the start that I wrote this script, but if you're looking to just do some transformations and pass some parameters to your XSLT (nothing too fancy) then you can try Magic XML.
您还可以通过在DOM元素上设置一些 data -
属性来自动提取数据并应用转换。例如......
You can also have it automatically pull in your data and apply transformations by setting some data-
attributes on your DOM elements. For example...
<div data-xml="example.xml" data-xslt="transform.xslt"></div>
...会自动从example.xml中提取数据并将transform.xslt应用于它。
...would automatically pull in data from example.xml and apply the transform.xslt to it.
适用于Opera,Chrome,Firefox和IE,并且是开源的。
It works in Opera, Chrome, Firefox and IE and is open source.
这篇关于使用Javascript / JQuery进行XML / XSL转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!