Obtain page sourceCode

女生的网名这么多〃 提交于 2019-12-11 06:51:01

问题


I have a page wich contains a XSL as it's source code. Is there any way to get the page source code (as seen on right-click->show source code in IE)?

EDIT: The page source code IS a XSL! I need to store it in a variable to use later.


回答1:


At first glance, the XML source seems to be irremediably lost in the transformation process. The simplest way I can think of is to use AJAX to query the page again. (On most browsers, this should be very fast because of caching.)

$.get(document.location, function(xml) { /* do something with xml */});



回答2:


Use a debugger, such as Firebug. It gives you access to the entire response.




回答3:


XSL is to XML as CSS is to HTML. Both simply define styles for outputting markup data.

If the XSL transform is done in the browser, you could find the XSL file path in the source with a line similar to this:

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

If that's what you're looking for, all you need to do is load that XSL document and view it.

More Info: http://www.w3schools.com/xsl/default.asp



来源:https://stackoverflow.com/questions/9708823/obtain-page-sourcecode

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