问题
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