%@LANGUAGE="VBScript"%>
<%
'tell client that we're sending an HTML page
Response.ContentType = "text/html"
Sub ShowError(objDoc)
'create and display error message
Dim strError
strError = "Invalid XML file !
" _
& "File URL: " & objDoc.parseError.url & "
" _
& "Line No.: " & objDoc.parseError.line & "
" _
& "Character: " & objDoc.parseError.linepos & "
" _
& "File Position: " & objDoc.parseError.filepos & "
" _
& "Source Text: " & objDoc.parseError.srcText & "
" _
& "Error Code: " & objDoc.parseError.errorCode & "
" _
& "Description: " & objDoc.parseError.reason
Response.Write strError
End Sub
Dim objXML
Dim objXSL
'create two document instances
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objXSL = Server.CreateObject("Microsoft.XMLDOM")
'set the parser properties
objXML.ValidateOnParse = True
objXSL.ValidateOnParse = True
'load the source XML document and check for errors
objXML.load Server.MapPath("poem.xml")
If objXML.parseError.errorCode <> 0 Then
'error found so show error message and stop
ShowError objXML
Response.End
End If
'load the XSL stylesheet and check for errors
objXSL.load Server.MapPath("poem98.xsl")
If objXSL.parseError.errorCode <> 0 Then
'error found so show error message and stop
ShowError objXSL
Response.End
End If
'all must be OK, so perform transformation
strResult = objXML.transformNode(objXSL)
'and insert the results into the page
Response.Write strResult
%>