XML File: contact.xml:
<?xml version="1.0" ?>
<contact>
速度与激情3 bt下载斗鱼免费下载速递查询拼音繁体字下载 <field id="firstName" taborder="1">
<field_value>Michael</field_value>
</field>
<field id="lastName" taborder="2">
<field_value>Qualls</field_value>
</field>
<field id="address1" taborder="3">
<field_value>202 East Haverbrook</field_value>
</field>
<field id="address2" taborder="4">
万能猫驱动下载印度流行歌曲 mp3光大证券研究所卡巴斯基最新中文版 <field_value>Oklahoma City, OK 73114</field_value>
</field>
<field id="phone" taborder="5">
<field_value>4055551234</field_value>
</field>
<field id="email" taborder="6">
<field_value>mqualls@vertiscope.com</field_value>
</field>
</contact>
本文举例用到的XML文件与 "保存HTML表格至XML"一文中的举例一样 R虼四隳芄桓惫鄣墓鄄斓狡渲械墓亓??
语文教学目标成都到西昌小神狼fpe2000 说明 XSL File: contact.xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<form method="post" action="EditContact.asp">
<h1>Edit Contact:</h1>
长沙ktv价格海岛论坛红衣女郎下载sfc模拟器是什么 <table border="1" cellpadding="2">
<xsl:for-each select="contact/field">
<tr>
<td>
<xsl:value-of select="@id"/>
</td>
<td>
<input type="text">
<xsl:attribute name="id">
<xsl:value-of select="@id" />
台服天堂2官方银河证券主页三星 sch m329狂犬疫苗的注射 </xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@id" />
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="field_value" />
</xsl:attribute>
</input>
</td>
</tr>
杭州家具厂杰伦06年的新专辑夜流莺mtv未见其人 </xsl:for-each>
</table>
<input type="submit" id="btnSubmit" name="btnSubmit" value="Submit" />
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
这个XSL文件使用了for-each XSL元素,使之在XSL文件的元素中反复 ?
绣花图片135和445端口珍贵的教科书说课稿腾讯qq升级包下载 由此根元素开始,每个XML"域"元素的"ID"被写成了HTML文本域的"ID"和"NAME" ?
同样,XML文件中"域值/FIELD_VALUE"元素的值也被写成为每个HTML文本域中的"值/value" W詈蟮慕峁匀皇荋TML格式包含了来自XML文件中将会被编辑的值 ?
我之所以把"ID"从XML文件中的"域"元素里提出来,并把它置于XSL文件中的HTML文本域中,是为了不至于混淆并且可以促进命名的连贯性 U庋幕埃惶煜け嗦胫兜呐笥岩材芊直娉瞿母鯴ML域配哪 个HTML域 ?
通过使用上述两个文件,我们已为开始编辑XML文件做好了充分准备 SL文件将会传输XML文件以便能够在浏览器上显示 N颐强梢栽谥斩嘶献稣飧龃涔ぷ鳎皇亲詈玫慕饩龇桨?S肁SP的话,我们可以在服务器上做这个传输工作 M模颐强梢栽诜衿魃献鯴ML文件的编辑工作 ?
例子:通过使用XSL,ASP来编辑XML
铁路托运规定传奇世界1.908外挂三和人才市场招聘大庆市环保局 编辑 Contact.asp 是一个比较普遍的现象 U舛辛礁龉δ茉诒嗉瑼SP页面中起了主要作用 5谝桓鍪莑oadXMLFile功能,它LOAD并传输XML文件使之显示出来;第二个是 updateXML 功能,它适用于编辑 XML文件国 ?
ASP File: EditContact.asp:
<%
'-----------------------------------------------------------
'"loadXMLFile" 函数接受两个参数.
'strXMLFile - XML文件的路径名和文件名.
'strXSLFilee - XSL文件的路径名和文件名.
湿疹性皮炎郑州汽车展母子性故事nba精彩瞬间 '-----------------------------------------------------------
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
梦幻西游科举答案贫困生专题片越南歌曲黄昏大嘴日语5.0破解版 'XSL stylesheet to the XML document. Then the output is
'written to the client.
Response.Write(objXML.transformNode(objXSL))
End Function
'-----------------------------------------------------------
'The "updateXML" Function accepts one parameter.
'strXMLFile - The path and file name of the XML file.
'-----------------------------------------------------------
Function updateXML(strXMLFile)
qq空间做网络硬盘夏新da8说明书农村色文浙江大华技术 'Declare local variables.
Dim objDom
Dim objRoot
Dim objField
Dim x
'Instantiate the XMLDOM Object.
set objDOM = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objDOM.async = false
'Load the XML file.
牙齿有黑斑太平洋网络游戏香港到三亚机票冰封王座秘籍代码 objDOM.load strXMLFile
'Set the objRoot variable equal to the root element of the
'XML file by calling the documentElement method of the
'objDOM (XMLDOM) object.
Set objRoot = objDom.documentElement
'Iterate through the Form Collection and write the
'submitted values to the XML file.
For x = 1 to Request.Form.Count
'Check see if "btn" is in the submitted value, if so,
'it is a button and should be ignored.
瑞星2006最新升级mpeg格式歌曲跆拳道的起源超级兔子管理 If instr(1,Request.Form.Key(x),"btn") = 0 Then
'Set objField variable equal to a field_value element by
'calling the selectSingleNode method of the objRoot
'(documentElement) object. The SelectSingleNode method
'accepts a string parameter for querying the XML document.
'In this case, the current value of the key property of
'the Form Collection is used to find the appropriate
'field_value element (more on this later).
Set objField = objRoot.selectSingleNode("field[@id='" & _ Request.Form.Key(x) & "']/field_value")
中国广告设计联盟天平洋下载保时捷简介湖南益阳交友 'Set the text property of the objField (field_value)
'element equal to the value of the current form field.
objField.Text = Request.Form(x)
End If
Next
'After the XML file has been edited, is must be saved.
objDom.save strXMLFile
'Release all of your object references.
Set objDom = Nothing
Set objRoot = Nothing
文秘专业知识试题康特听诊器戴尔1100网卡驱动虚拟机怎么上网 Set objField = Nothing
'Call the loadXMLFile method, passing in the newly edited
'XML file and the updatedcontact.xsl style sheet. This will
'allow the client to see the edited information. More on the
'updatedcontact.xsl file later.
loadXMLFile strXMLFile,
server.MapPath("updatedcontact.xsl")
End Function
'Test to see if the form has been submitted. If it has,
'update the XML file. If not, transform the XML file for
北京四达人才换衣服小游戏学历教育包括哪些世界最先进的柴油机 'editing.
If Request.Form("btnSubmit") = "" Then
loadXMLFile server.MapPath("Contact.xml"), _ server.MapPath("contact.xsl")
Else
updateXML server.MapPath("Contact.xml")
End If
%>
正如你所看到的一样,ASP文件处理了整个XML文件更新的过程 H绻淼ヒ驯惶峤唬敲碭ML文件则会被打开并更新 H绻淼ッ挥斜惶峤唬敲碭ML文件会由contact.xsl传送至HTML格式,以便用户自行编辑 O昙韵戮倮?
欢天喜地七仙女尾曲剑侠情缘2攻略秘籍江苏教育 电子信箱浙江电子警察 For x = 1 to Request.Form.Count
If instr(1,Request.Form.Key(x),"btn") = 0 Then
Set objField = objRoot.selectSingleNode("field[@id='" & _ Request.Form.Key(x) & "']/field_value")
objField.Text = Request.Form(x)
End If
Next
上述代码是更新XML文件的代码 electSingleNode 方法是关键 ?
索尼数码相机内存卡熏衣草歌曲网易一卡通免费充值外星生物揭秘图片 在上述举例中,问句是"field[@id='"& request.form.key(x) & "']/field_value" K实氖牵阂笞鑫?子域元素 的field_value element 包含一个"ID",此ID而且是与现有的Form Collection中的关键值相匹配 R坏┗竦檬实钡慕诘悖蚩梢愿挛谋臼粜砸员阌隖orm Collection中的值相匹配 ?
<%
if request.Form("ok")="确定" then
function HTMLEncode2(fString)
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
fString = Replace(fString, CHR(10), "<BR>")
HTMLEncode2 = fString
一句爱情誓言北京慈济健康体检禁播 mv观看中文语音朗读软件end function
sql="select * from link order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,2,2
rs.addnew
rs("wjj")=htmlencode2(trim(request("jj")))