建立XML文件skin.xml
<?xml version="1.0" encoding="gb2312"?>
<skin id="默认风格">
[table border="1" cellspacing="0" cellpadding="0" width="100%"]
[tr]
[td]
现在的时间是:$now$
[/td]
[/tr]
[/table]
</skin>
建立ASP文件skin.ASP
<%
'初始化变量
dim YCM,child,skin
'建立XML对象
set YCMS=Server.CreateObject("Microsoft.XMLDOM")
'创建属性是否独立使用的
YCMS.async=false
'载入在服务器上的XML文件
YCMS.load(server.mappath("skin.xml"))
'建立XML文档元素对象
set go=YCMS.DocumentElement
'开始替换XML文件中的字符
skin=replace(go.childNodes.item(0).text,"[","<")
skin=replace(skin,"]",">")
skin=replace(skin,"$now$",now())
'输出HTML模板代码并执行
response.write ""&skin&""
set go=nothing
set YCMS=nothing
%>
见过的思路最简洁的办法,但是效率还无法考证。