Obtain page sourceCode

2019-08-02 06:48发布

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.

3条回答
三岁会撩人
2楼-- · 2019-08-02 07:36

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 */});
查看更多
做个烂人
3楼-- · 2019-08-02 07:37

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

查看更多
ゆ 、 Hurt°
4楼-- · 2019-08-02 07:40

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

查看更多
登录 后发表回答