How to transform an XML file with XSLT, using a Greasemonkey script?

后端 未结 2 703
执笔经年
执笔经年 2021-01-15 02:56

I have a search server that provides a test page where I can input a query and it returns the results in XML. I want to be able to go through the results in a more user frie

2条回答
  •  感情败类
    2021-01-15 03:23

    I would have added this in a comment, but I don't have the relevant reputation. There are two things that I would check. Especially if this is working on a string, and not a file from the server like you said

    1. Make sure that what you are getting from the server is a string, and not an object
    2. Make sure the xml you are getting from the server is correct.

    If you aren't getting a string, you can do an ajax request to get the text from the xml. And then load that as your new xml var.

    And if you really just wanted to make your xml user friendly, I would suggest checking out
    http://code.google.com/p/vkbeautify
    and
    http://google-code-prettify.googlecode.com/svn/trunk/README.html

    Those should maintain the xml format while stylizing it to make it easy to read. Plus, you won't have to mess with greasemonkey, and can instead just use javascript.

提交回复
热议问题