哪个浏览器可以显示由 XSLT 转换的 XML 数据? [英] Which browser can show XML data transformed by XSLT?

查看:21
本文介绍了哪个浏览器可以显示由 XSLT 转换的 XML 数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比如说,如果有一个名为 data.xml 的文件,以及一个名为 format.xsl 的文件(或者是 format.xmlcode> ?),就是用CSS对XML数据进行转换和格式化,那么哪个浏览器可以显示呢?应该打开哪个文件?(.xsl 还是 .xml?)

say, if there is a file that's call data.xml, and a file that is format.xsl (or is it format.xml ?), which is to transform the XML data and format it as well using CSS, then which browser can display it? Which file should be opened? (the .xsl or the .xml?)

其实我在另一个例子中看到XSLT文件的第一行是href="format.xsl",所以我以为XSLT文件已经是.xsl?那么它是如何链接到另一个 .xsl 文件的呢?有多少个文件,2 个还是 3 个?

Actually I saw in another example that the XSLT file's first line is to href="format.xsl", so I thought the XSLT file is already the .xsl ? then how come it is linking to another .xsl file? How many files are there, 2 or 3?

推荐答案

有两个文件,一个包含数据的 .xml 和一个带有用于转换的 XSLT 脚本的 .xsl.截至 2010 年 8 月,所有主流浏览器都支持客户端 XSLT 转换.打开 .xml 文件,将使用关联的 .xsl 文件.通常,脚本会构建一个动态显示的 html 文档.转换也可以由服务器用PHP等来完成.
要关联 XSLT 脚本,.xml 文件需要这样一行:

There are two files, one .xml containing data and one .xsl with the XSLT script for transformation. As of August, 2010, all leading browsers support client side XSLT transformation. Open the .xml file and the associated .xsl file will be used. Usually the script builds an html document which is displayed on the fly. The transformation can also be done by the server with PHP etc.
To associate a XSLT script, the .xml file needs a line like this:

<?xml-stylesheet type="text/xsl" href="script.xsl" ?>

Edit 18.04.2021:这个问题已经过去 10 年了,而且发生了很多事情.现在可以使用 Saxon-JS 在浏览器中运行 XSLT 3.0.Github 上有一个 Hello World.

Edit 18.04.2021: The question is 10 years old now and a lot has happened. It's possible now to have XSLT 3.0 running in the browser using Saxon-JS. There's a Hello World on Github.

这篇关于哪个浏览器可以显示由 XSLT 转换的 XML 数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆