Discussion:
HELP!: session variables (with)in XSL
(too old to reply)
segis bata
2006-01-09 16:56:25 UTC
Permalink
Hello everyone,

I'm new to xsl and here is what I want to accomplish: I want to pass a
session variable populated in an ASP page to a XSL file being called by that
ASP page

is it possible? and if so, how?

sorry if someone already posted this problem but I've read all the messages
I could download from this newsgroup and didn't see anything regarding this
subject

Thanks in advance for your help and, if possible, prompt response

SB-R
Martin Honnen
2006-01-09 18:24:06 UTC
Permalink
Note followup-to set to microsoft.public.xsl
Post by segis bata
I'm new to xsl and here is what I want to accomplish: I want to pass a
session variable populated in an ASP page to a XSL file being called by that
ASP page
Your XSLT stylesheet needs to declare a global parameter e.g.
<xsl:param name="parameterName" />
and then you need to create an XSLT processor object and set the
parameter as needed before you do the transformation.
VBScript alike
Set XslStylesheet = Server.CreateObject(_
"Msxml2.FreeThreadedDOMDocument.3.0")
XslStylesheet.async = False
XslStylesheet.load Server.MapPath("file.xsl")
Set XslTemplate = Server.CreateObject(_
"Msxml2.XslTemplate.3.0")
XslTemplate.stylesheet = XslStylesheet
Set XsltProcessor = XslTemplate.createProcessor()
XsltProcessor.addParam "parameterName", "parameterValue"
'Now you can set XsltProcessor.input and output and
'call the transform method

That way you can pass strings, boolean values, numbers and DOM nodes to
the stylesheet. If your session variable stores objects then you might
need to pass it as an extension object.

Docs are here
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/9ddcd728-2646-494a-8fa4-3b68e8c032b7.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/106f85e4-6aa4-44ce-945a-23b2143586d2.asp>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Loading...