例: CreateXSLTransformer method

次のエージェントは、FOO.XSL を使用して FOO.XML を変換します。変換結果は、テキストとして 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