Examples: CreateXSLTransformer method

This agent transforms FOO.XML using FOO.XSL. The output of the transformation is text written to FOO.TXT.

Sub Initialize
  Dim session As New NotesSession
  filename$ = "foo"
  
  Dim xmlin As NotesStream
  Set xmlin=session.CreateStream
  If Not xmlin.Open("c:\dxl\" & filename$ & ".xml") Then
    Messagebox "Cannot open " & filename$,, "Error"
    Exit Sub
  End If
  If xmlin.Bytes = 0 Then
    Messagebox "File did not exist or was empty",, filename$
    Exit Sub
  End If
  
  Dim xslin As NotesStream
  Set xslin=session.CreateStream
  If Not xslin.Open("c:\dxl\" & filename$ & ".xsl") Then
    Messagebox "Cannot open " & filename$,, "Error"
    Exit Sub
  End If
  If xslin.Bytes = 0 Then
    Messagebox "File did not exist or was empty",, filename$
    Exit Sub
  End If
  
  Dim xmlout As NotesStream
  Set xmlout=session.CreateStream
  Call xmlout.Open("c:\dxl\" & filename$ & ".txt")
  Call xmlout.Truncate
  
  Dim transformer As NotesXSLTransformer
  Set transformer=session.CreateXSLTransformer(xmlin, xslin, _
  xmlout)
  Call transformer.Process
End Sub