当用户通过IE看到我的XML文件时,那用于控制显示样式的XSL文是不是也一起到了客户端呢?

当用户通过IE看到我的XML文件时,那用于控制显示样式的XSL文是不是也一起到了客户端呢?
---------------------------------------------------------------

only if you add this line to the top of your xml file

---------------------------------------------------------------

只要你XML文件里套用了合适的XLST文件,XSL文就也一起到了客户端
要不怎么可以浏览到你用XSL排版好的网页呢
---------------------------------------------------------------

你可以在服务器端进行转换后再输出,这样就不会看到xsl了
---------------------------------------------------------------

Function loadXMLFile(strXMLFile, strXSLFile)
'本地变量
Dim objXML
Dim objXSL
'初始化XMLDOM对象.
set objXML = Server.CreateObject("Microsoft.XMLDOM")
'关闭同步加载的文件.
objXML.async = false
'加载XML文件.
objXML.load(strXMLFile)
'初始化用于加载XSL文件的XMLDOM对象.
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objXSL.async = false 'Load the XSL file.
objXSL.load(strXSLFile)
'Use the "transformNode" method of the XMLDOM to apply the
'XSL stylesheet to the XML document. Then the output is
'written to the client.
Response.Write(objXML.transformNode(objXSL))
End Function

这是在服务器转换的函数,

客户端的另外一种:

1<script language="JScript">   
2function window.onload()   
3{   
4divMenuToken.outerHTML = xmlMenuData.transformNode(xmlMenuStyle.documentElement);   
5}   
6  
7</script>
1<xml id="xmlMenuData" src="/CmsNetCn/Bid_V2/xml/AUDIT/BIDER.asp?BOOK_ID=623&amp;BIDER_ID=155594"></xml>
1<xml id="xmlMenuStyle" src="/CmsNetCn/Bid_V2/xml/AUDIT/all.xsl"></xml>
1<div id="divMenuToken"></div>
Published At
Categories with Web编程
comments powered by Disqus