Implementation of ASP processing XSLT transformation XML

Source: Internet
Author: User
Tags xslt

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.