怎样实现利用xslt把xml文件内容显示到html文件中?急!
jeall 2003-12-19 02:17:23 ==============*.html源代码============
<HTML>
<Head>
<META http=equiv="Content-Type" Content="text/html;charset=gb2312">
<STYLE>
body { font-family:宋体; font-size:9pt;}
th { font-family:宋体; font-size:11pt; font-weight:bold;}
</STYLE>
<Script language="vbscript">
Option Explicit
Dim intRecordsPerPage '每个页面显示的记录数
intRecordsPerPage = 5 '每个页面显示的记录数,默认设定为5
' 更新显示页面的函数
Function window_onload()
' 显示设定的记录数
Style.XMLDocument.selectNodes("//xsl:for-each/@select")(1).Value = "./*[position() < " & intRecordsPerPage + 1 & " and position() > 0]"
transform()
setPageCount()
End Function
' 进行XML-XSLT转换,并显示当前记录的一些信息
Function transform()
DisplayArea.innerHTML = Data.transformNode(Style.DocumentElement)
RecordsPerPage.Value = intRecordsPerPage
End Function
' 重新转换XML,并显示一个状态信息
Function redisplay(intPage)
Dim strDisplay
Dim intPageCount
Dim intRecordCount
' 保存状态信息
intPageCount = PageCount.innerHTML
intRecordCount = RecordCount.innerHTML
transform()
' 显示状态信息
PageCount.innerHTML = intPageCount
RecordCount.innerHTML = intRecordCount
CurrentPage.innerHTML = intPage
End Function
' 重新排序和显示
Function Sort(strField)
Dim sortField
Dim sortOrderAttribute
' 得到排序属性值
Set sortField = Style.XMLDocument.selectSingleNode("//xsl:sort/@select")
Set sortOrderAttribute = Style.XMLDocument.selectSingleNode("//xsl:sort/@order")
' 改变排序的方式
If sortField.Value = strField Or sortField.Value = "./*[0]" Then
If sortOrderAttribute.Value = "descending" Then
sortOrderAttribute.Value = "ascending"
Else
sortOrderAttribute.Value = "descending"
End If
Else
sortField.Value = strField
sortOrderAttribute.Value = "ascending"
End If
Set sortField = Nothing
Set sortOrderAttribute = Nothing
redisplay (CurrentPage.innerHTML)
End Function