我想在一个html文档中,插入一段由xml+xsl输出的html代码,请问可以实现吗?

CFree 2001-09-22 10:22:34
如果可以,请告之。
谢谢!
...全文
73 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
karma 2001-09-23
  • 打赏
  • 举报
回复
1.在客户端,相应的xml文档该如何载入?在何处载入?
loaded from your server, in the same directory as your html file, or you can change the location of the file, like from its parent's directory, "../myxml.xml":

<div id="blah"></div>
<script>
var xmldoc, xsldoc;
xmldoc = new ActiveXObject("MSXML2.DOMDOCUMENT");
xmldoc.async = false;
xmldoc.load("myxml.xml");

xsldoc = new ActiveXObject("MSXML2.DOMDOCUMENT");
xsldoc.async = false;
xsldoc.load("yourxml.xsl");

document.all("blah").innerHTML = xmldoc.transformNode(xsl);
</script>

2.<div>之间放的是xml字符吗?
no, it will be html code after the transformation, isn't that what you want?


CFree 2001-09-23
  • 打赏
  • 举报
回复
karma(无为):在客户端,相应的xml文档该如何载入?在何处载入?
<div>之间放的是xml字符吗?可以是一个外部的myxml.xml文件吗?
谢谢!
karma 2001-09-23
  • 打赏
  • 举报
回复
You can use XML::XSLT module or XML::Sablotron to transform XML.

But if you have the win32 component of Perl (like Active Perl from ActiveState) installed, you certainly can use MSXML3 directly in Perl script.
eternalee 2001-09-23
  • 打赏
  • 举报
回复
请问 karma(无为):
用 perl 应该怎么写?
karma 2001-09-23
  • 打赏
  • 举报
回复
yes, of course

Once you load your xml and xsl files, you can do it on the server side with
<%
response.write xmldoc.transformNode(xsldoc)
%>

or on the client side:
<div id="blah"></div>
<script>
//load your xml/xsl doc
document.all("blah").innerHTML = xmldoc.transformNode(xsl);
</script.

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧