How do I get a page (or URL) into a NotesStream?

Hi, I’ve found examples in the forum on reading a stylesheet into a NotesStream from an OS level file (open) and a string variable (writeText).

My XSL Stylesheet is stored in a page in notes. Does anyone know how to get this into a NotesStream so I can use the NotesXMLTransformer class to output HTML?

Thanks in advance.

Subject: How do I get a page (or URL) into a NotesStream?

Try something like this

Set stream = session.CreateStream

path$ = “C:\DXL\DXLCODE.DXL”

filename$ = path$

If Not stream.Open(filename$) Then

Messagebox "Cannot open " & filename$,, "Error"

Exit Sub

End If

Call stream.Truncate

Set nc = collectiondb.CreateNoteCollection(True)

Call nc.SelectAllDesignElements(True)

Call nc.SelectAllCodeElements(False)

Call nc.SelectAllFormatElements(False)

Call nc.SelectAllIndexElements(False)

Call nc.SelectAllAdminNotes(False)

nc.SelectPages = True

Call nc.BuildCollection

Msgbox Cstr(nc.Count) + " designElements are being exported"

'REM Export note collection as DXL

Set exporter = session.CreateDXLExporter(nc, stream)

Call exporter.Process

Subject: RE: How do I get a page (or URL) into a NotesStream?

Thanks for the tip. Got it, following function gets the page text:

Function getPageText(db As NotesDatabase, pageName As String) As String

'Gets a notes page design element and returns the text of the page. Designed for apps where XSLT info is stored in a page.

Dim nCol As NotesNoteCollection

Dim doc As NotesDocument

Dim title As NotesItem, body As NotesItem

Dim noteID As String

'Build a NotesNoteCollection of all page design elements in the database

Set nCol=db.CreateNoteCollection(False)

nCol.SelectPages=True

Call nCol.BuildCollection

'Find page that corresponds to pagename

noteID=nCol.getFirstNoteID

Do Until noteID=“”

Set doc=db.GetDocumentByID(noteID)

Set title=doc.GetFirstItem(“$TITLE”)

Set body=doc.GetFirstItem(“$Body”)

If title.Text=pageName Then

getPageText=body.Text

Exit Function

End If

noteID=nCol.GetNextNoteId(noteID)

Loop

getPageText=“”

End Function

Then just need to create notes stream and and use writetext method.