使用浏览器测试xslt代码 [英] Testing xslt code using your browser
问题描述
目前我正在将我的xml和xslt代码复制到 w3school的示例页面并在此处进行测试。
然而,这是一个真正的痛苦,因为插入选项卡在那里不起作用,语法突出显示未激活,输出窗口太小。
所以:- 这是不方便的,我必须设置什么来测试我的xslt代码?
- 是否必须将xslt文件的名称更改为xhtml或html?
- 如何测试xslt代码?
我想调用链接 file:// code。例如,在我的浏览器中查看xslt
。
我在Ubuntu,Linux上。
使用Chrome进行测试
为了规避chrome的相同原点策略,我必须用 google-chrome - 允许从文件访问文件
。
在浏览器中测试XSLT的超级简单方法是添加在您的XM标题后面L源文件:
<?xml-stylesheet type =text / xslhref =mystylesheet.xsl?> ;
然后在浏览器中加载它(XML源代码)。
另一种选择是使用带有JavaScript的独立HTML文档加载XML和XSLT文档并启动转换。
这些都不是真的可以取代一个专门的应用还要注意,你已经用XSLT 2.0标记了这个标记,但我不知道任何支持它的浏览器。
Using my browser, I want to test if my xslt code is working.
Currently I am copy pasting my xml and xslt code into w3school's example page and test it there.
However, this is a real pain, since inserting tabs don't work there, syntax highlighting isn't active and the output window is too small. It is inconvenient to test your code there in general.
So:
- What do I have to setup to test my xslt code?
- Do I have to change the name of the xslt file to xhtml or html?
- How do you test xslt code in general?
I want to call the link file://code.xslt
in my browser and see the result, for example.
I am on Ubuntu, Linux.
Testing with Chrome
To circumvent chrome's same origin policy, I had to restart chrome with google-chrome --allow-file-access-from-files
.
A super-simple way to test your XSLT in a browser is to add the following header to your XML source document:
<?xml-stylesheet type="text/xsl" href="mystylesheet.xsl"?>
then load it (the XML source) in the browser.
Another option is to use a stand-alone HTML document with some javascript to load your XML and XSLT documents and initiate the transform.
None of these can really replace a dedicated application. Note also that you have tagged this with XSLT 2.0, but I don't know of any browser that supports it.
这篇关于使用浏览器测试xslt代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!