Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transforming XML with MSXML, not bui;t in .NET

Status
Not open for further replies.

NBartomeli

Programmer
Jul 1, 2003
111
0
0
US
I am looking for an example in VB.NET which outlines XML/XSLT transformations using MSXML, not the XML classes which are built into .NET (speed reasons)

I have been unable to find an example on MSDN, other than for scripting languages.

need a concrete example showing showing how to load the XML document, load the XSLT stylesheet, and perform the transform

I have a post in the XML forums, but haven't been able to solicit the information I need.

Thanks for any help in advance

 
I found this just now, but I get an "Object reference not set to an instance of an object." error on the line in red:

Code:
On Error GoTo Handle
' Create FreeThreadedDOMDocument
Dim oXSLT As New MSXML2.XSLTemplate
Dim oStyleSheet As New MSXML2.FreeThreadedDOMDocument
Dim oXSLTProc As MSXML2.IXSLProcessor
Dim oXMLSource As New MSXML2.DOMDocument30

' Load the XSLT Stylesheet
oStyleSheet.async = False
oStyleSheet.Load ("C:\XMLMigration\books.xsl")

' Create the XSLTemplate object
Set oXSLT.stylesheet = oStyleSheet

' Create the XSLProcessor object;
Set oXSLTProc = oXSLT.createProcessor()

' Load XML source in DOMDocument
oXMLSource.async = False
oXMLSource.Load ("C:\XMLMigration\books.xml")

' Add a global paramter.
oXSLTProc.addParameter "TableOnly", "Yes", ""

' Assign XML source to XSLProcessor object
[COLOR=red]oXSLTProc.input = oXMLSource[/color]

' Invoke the transformation
oXSLTProc.Transform

' Use output of transformation.
Debug.Print (oXSLTProc.output)
Exit Sub
Handle:
Debug.Print ("Error : " & Err.Description)

any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top