Testing xslt code using your browser

匿名 (未验证) 提交于 2019-12-03 01:58:03

问题:

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.

Here and here is more info.

回答1:

A super-simple way to test your XSLT in a browser is to add the following header to your XML source document:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!