Read XSL stylesheet via a Page in Notes client?

I’ve seen description on using a Page as an alternative to a physical file for storing an XSL Stylesheet. Great. But I cannot find anywhere in the designer help what lotusscript syntax I can use to call/open the Page, so that my NotesSteam can read the stylesheet. This is for executing in the Notes client.

Syntax to read from a physical file (xslin is notesstream) works fine.

xslin.Open(“C:.…\stylesheetxyz.xsl”)

I had hoped this would work for reading the same stylesheet info from a page with alias stylesheetzyz.xsl, but it no such luck.

xslin.Open(“Notes://<database path&name>/stylesheetzyz.xsl”)

Any help or tips are appreciated.

Subject: Read XSL stylesheet via a Page in Notes client

Hi, I couldn’t get this to work. I kept on getting: Result String is too long.

Subject: Solution

I’m on v7.0.2 but the solution is likely to be upwards compatible.Use the NotesNoteCollection object to collect all pages, then look for the one you need, then get the $BODY item, convert it to plain text and use the literal string as stylesheet in the NotesXSLTransformer object. (It’s undocumented but works.)

Be careful not to have longer than 80 char lines in the page because the text conversion breaks the line and if it breaks in the middle of a tag then the XLST is broken. (There might be a workaround for this but I don’t need it.)

Here’s the code to retrieve the page with the given name:

Function GetPagePlainText (pagename As String) As String

’ Locates a page defined by the pagename parameter

’ Returns the plain text representation of the page

’ Which could be anything, even an XSLT

’ Literal string can then be fed to the Notes XSLTransformer object

Dim s As New NotesSession

Dim ws As New NotesUIWorkspace

Dim nc As NotesNoteCollection

Dim db As NotesDatabase

Dim found As Boolean

Dim body As Variant

Set db=s.CurrentDatabase

Set nc = db.CreateNoteCollection(False)

nc.SelectPages = True

Call nc.BuildCollection

If nc.Count=0 Then Error 4552,“There aren’t any pages in this database”

found=False

i=0

nid = nc.GetFirstNoteId

Do

Set doc = db.GetDocumentByID(nid)

If doc.GetFirstItem("$$ScriptName").Values(0) = pagename Then found=True

nid = nc.GetNextNoteId(nid)

i=i+1

Loop While i<nc.Count And Not found

If Not found Then Error 4801, “Couldn’t find page “+pagename$+”.”

GetPagePlainText = doc.GetFirstItem(“$BODY”).Text

End Function

And a snippet how to use it in the transformer:

Set Transformer = session.CreateXSLTransformer (Exporter, GetPagePlainText(“MyXSLTPageName”))