Using ASP to process XSLT transformation XML is simpler, as follows: Create a Xsltemplate object, then create a Xmldom object, and then in the home XML file and XSLT file, the last use method transform can be included in the class, the specific code is as follows:
The following is a reference fragment:
Class Cls_xml_transform
Private linput,xsltemplate
Private P_output
Public Property Get Output ()
Output = P_output
End Property
Private Property Let Output (ByVal strinfo)
P_output = Strinfo
End Property
Public Property Let Input (ByVal vnewvalue)
If IsObject (vnewvalue) Then Set linput=vnewvalue
End Property
Public Property Let Xsltemplatefile (ByVal vnewvalue)
Dim StyleSheet
Dim Vnewvalue_
Vnewvalue_ = Vnewvalue
If not INSTR (Vnewvalue, ": \") > 0 Then
Vnewvalue = Server.MapPath (vnewvalue)
End If
Set xsltemplate=server.createobject ("Msxml2.xsltemplate")
Set stylesheet=server.createobject ("Microsoft.FreeThreadedXMLDOM")
Stylesheet.load Vnewvalue
Xsltemplate.stylesheet=stylesheet
End Property
Public Sub Transform ()
DIM proc
Set proc = xsltemplate.createprocessor ()
Proc.input=linput
Proc.transform ()
Output=proc.output
Set proc=nothing
End Sub
End Class
Use Example:
The following is a reference fragment:
Set XMLDOM = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")
XMLDOM.async = false
XMLDOM.load(Server.MapPath("bi2.xml"))
Set o=new Cls_IO_Transform
o.XSLTemplatefile="bi2.xsl"
o.Input=XMLDOM
o.Transform()
response.write o.Output()
This is handled directly by the Xmldom object, and, if necessary, flexibly can be modified.