Public Sub Transform(sourceFile, stylesheetFile, resultFile)
' For Access 2010 VBA ----> Menu Tools Reference choose Microsoft XML, 6.0
' Example of using Access VBA to grab an XML file from the web (or file location)
' that has 2nd site with a Style Sheet.
Dim source As New MSXML2.DOMDocument30
Dim stylesheet As New MSXML2.DOMDocument30
Dim result As New MSXML2.DOMDocument30
' Load data.
10 source.async = False
20 source.Load sourceFile
' Load style sheet.
30 stylesheet.async = False
40 stylesheet.Load stylesheetFile
50 If (source.parseError.ErrorCode <> 0) Then
60 MsgBox ("Error loading source document: " & source.parseError.Reason)
70 Else
80 If (stylesheet.parseError.ErrorCode <> 0) Then
90 MsgBox ("Error loading stylesheet document: " & stylesheet.parseError.Reason)
100 Else
' Do the transform.
110 source.transformNodeToObject stylesheet, result
120 result.Save resultFile
130 End If
140 End If
150 Debug.Print "Error is " & Err.Number
' To run the above - This is a web site that has simple XML sites
' The example is a XML file with an associated XML Style Sheet
' To run the above code - and save the result in C:\MyFolder
' Transform "http://www.w3schools.com/xml/simplexsl.xml", _
"http://www.w3schools.com/xml/simple.xsl", _
"C:\myfolder\AtemptempImport.xml"
' Rx_
End Sub