[xsl] Import ASP Request Object into XSLT

Subject: [xsl] Import ASP Request Object into XSLT
From: "Julie M. Gephart" <julie@xxxxxxxxxxxxxxx>
Date: Wed, 3 Apr 2002 13:25:12 -0800
I generate lots of forms using XSLT on the server side to return HTML to the
client.  When there is an error that requires me to re-present the form to
the user, I'd like to preserve whatever they just submitted from the Request
object.  I have been able to successfully use other ASP objects in my XSLT
by using the addObject method with an XSL Processor, but I have not been
able to find a way to make it work with Request (or Request.Form or
Request.QueryString).  Below is code that works for using the ASP Session
object - can anyone make something similar work with Request?


<% 'ASP VBS code

'Put something into a session variable
Session("TESTVARIABLE") = "TestValue"

sXML="<xml></xml>" 'xml unimportant in this example
sXSLpath = server.MapPath("mystylesheet.xsl")

'Create the Template and Processor objects
Set xmlDoc = server.CreateObject ("Msxml2.FreeThreadedDOMDocument.3.0")
xmlDoc.async = false
xmlDoc.loadXML(sXML)
Set xslt = server.CreateObject("MSXML2.XSLTemplate.3.0")
Set xslDoc = server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
xslDoc.async = false
xslDoc.load(sXSLpath)
xslt.stylesheet = xslDoc
Set xslProc = xslt.createProcessor()
xslProc.input = xmlDoc

xslProc.addObject Session, "urn:ASPSession"
xslProc.transform
sOutput = xslProc.output
response.write sOutput

%>

XSLT: ("mystylesheet.xsl")
<?xml version="1.0"?>
<xsl:stylesheet 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" 
	xmlns:Session="urn:ASPSession"
>
<xsl:output method="html" indent="yes"/> 

<xsl:template match="/">
Session Test value=<xsl:value-of
select="Session:get-Contents('TESTVARIABLE')"/>
</xsl:template>

</xsl:stylesheet>

I would think that "Request:get-QueryString('TestVar')" would be an
identical structure to "Session:get-Contents('TestVar')", but apparently it
is not.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread