if you are developing intranet applications, then normally the client machines are powerful, sending data to the client and processing data there is not a problem
if your xml data is dynamic and you are developing applications for users with diverse machine capabilities, then you have no choice but do the transformation on the server
我试过了,直接写回xml的数据岛,由于父类是CHttpServer,所以并不能解释并显示出xml
2 无为:
偶知道您是大虾,您说的那个东东俺懂,可是并不是那样就可以的。目前是server应该用哪个,反正CHttpServer是不行的,它对应的是html。而在isapi中,vc的wizard自动建立的就是CHttpServer的一个子类。xml有一个ServerXMLHTTP,我想问的是:结合isapi该如何使用?再有就是xml内容可以直接由类似"select * from 院系基本信息 for xml auto,ELEMENTS"这样的sql语句得到xml数据岛,这样就不用我们自己生成了(如果有特殊需要还是要的)。现在是如何显示的问题。
偶查了查原来的资料,发现还可以这样实现:
<html>
<head>
<script language="JavaScript" for="window" event="onload">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("xmlData/xmlzhgs.asp");
var xslDoc = new ActiveXObject("Microsoft.XMLDOM");
xslDoc.async="false";
xslDoc.load("xslData/zhgs.xsl");
idXML.innerHTML = xmlDoc.transformNode(xslDoc);
function layerShow(strID){
node = xmlDoc.selectSingleNode("//row[@id="+strID+"]");
alert(strID);
while (true){
node = node.nextSibling;
myID = node.getAttribute("id");
if (myID.substr(0,strID.length) == strID){
if (node.getAttribute("show") == "T")
node.setAttribute("show","F");
else
node.setAttribute("show","T");
}
else
break;
}
idXML.innerHTML = xmlDoc.transformNode(xslDoc);
return true;
}
</script>
1. "想问问,对比CHttpServer和CHtmlStream,XML有无对应或相关class可代替之? "
you can download MSXML3 SDK or MSXML4 SDK and use classes in them
2. "目前这是否是最地道的解决办法呢"?
these are the normal methods to do XSLT transformation:
a. output xml directly (with an xml-stylesheet pi) and have the browser take care of the transformation
b. embed xml/xsl island inside the pages and do the transformation on the client side using javascript
c. dynamically load xml/xslt and do the transformation on the client side using javascript
d. do the transformation on the server side