我自己写了一个xslt转换jQuery的api文件(xml),现在就是有一个问题,里面的demo不知道怎么写了。如下面的图片,这是jQuery官方文档的demo实现方式,是一个iframe,我就在想怎么把xml文件里面那个节点内容放进这个iframe里呢,它的所有iframe的src都一样的,肯定不是生成一个html文件的.我不知道怎么弄了,谢谢!
[img]http://dl.iteye.com/upload/attachment/0070/2720/fdbf2e7d-6b8a-3dfe-b277-314bb5dbcbca.jpg[/img]
[img]http://dl.iteye.com/upload/attachment/0070/2722/ce39b2c4-18de-300c-a769-bc1f7336dced.jpg[/img]
XML的代码
[code="xml"]
Remove the two white spaces at the start and at the end of the string.<![CDATA[
var str = " lots of spaces before and after ";
$("#original").html("Original String: '" + str + "'");
$("#trimmed").html("$.trim()'ed: '" + $.trim(str) + "'");
]]>
<![CDATA[
只要拿到iframe的document,然后open write close就行了
给你个示例代码
[code="html"]
window.onload=function(){
document.body.innerHTML+='';
var fwin=document.getElementById("ifm").contentWindow;
var fdoc=fwin.document;
var script='window.onload=function(){document.body.innerHTML="hello!"}';
fdoc.open();
fdoc.writeln('<html><head><style>p{margin:0px;padding:0px;}body{margin:0px;padding:0px;font:16/18px Arial;}</style></head><body><script>'+script+'</script></body></html>');
fdoc.close();
}
[/code]
XML应该是用来存放数据的,而XSLT用来存放HTML样式,可以参看这里的内容
[url]http://www.cnblogs.com/zhihui516/archive/2008/10/12/1308873.html[/url]