RE: [xsl] Asp Variable into XSLT

Subject: RE: [xsl] Asp Variable into XSLT
From: "Piers Haken" <piersh@xxxxxxxxxxx>
Date: Thu, 14 Jun 2001 09:22:07 -0700
If you're also going to always write the results of the transform out to
the Response object. Why not also do the following:

   set proc = tem.createProcessor()
   proc.addParameter("someValue", someValue) ' someValue="this is the
some value string"
   proc.input = doc
   proc.output = Response;	// <<----
   proc.transform();

Doing this removes the need to copy the results around.

In fact, I believe you can use async loads and the processor will handle
it, although I haven't tried this. Anyone know if this is true?

Piers.

-----Original Message-----
From: Chris Bayes [mailto:Chris@xxxxxxxxxxx] 
Sent: Wednesday, June 13, 2001 6:25 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Asp Variable into XSLT


Karlo,
The way to do this is to pass a parameter into the transformation.

   dim doc, stylesheet
   set doc = Server.CreateObject("msxml2.DOMDocument")
   set stylesheet =
Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
   set template = Server.CreateObject("MSXML2.XSLTemplate");
   xmlsource=Server.MapPath("XML/XML_1.xml")
   xslsource=Server.MapPath("XSL/XSL_1.xsl")
   doc.async = false
   stylesheet.async = false
   doc.load(xmlsource)
   stylesheet.load(xslsource)
   template.stylesheet = stylesheet
   set proc = tem.createProcessor()
   proc.addParameter("someValue", someValue) ' someValue="this is the
some value string"
   proc.input = doc
   proc.transform();
   str = proc.output;
   Response.Write(str)

Then within your stylesheet you have
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"
>
<xsl:param name="someValue" />
<xsl:template match="/">
	<xsl:value-of select="$someValue" />
</xsl:template>
</xsl:stylesheet>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of 
>pcaspian@xxxxxxxxxxx
>Sent: 13 June 2001 14:02
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: [xsl] Asp Variable into XSLT
>
>
>Plat: Win2000
>Lang: ASP
>
>
>Hi, I am curious as to how his works. As far as I know this could be 
>very complicated / extremely difficult and as my XSLT book hasnt 
>arrived, I will have to rely on your knowledge.
>
>I am making use of XML combined with ASP and generally just importing 
>the xml file and converting it to html where needed with 
><%Response.Write(source.transformNode(style))%>.
>
>Now I want to make use of XML, but at times I will have an input 
>variable from ASP, eg: if my page has loaded successfully, I want to 
>display data from a specific XML element and if not then data from 
>another XML element. Basically get an input variable into my XSL 
>document I suppose. Im sure this is done and this comes across as just 
>a daft question, but I've not come across it yet and cant find any 
>examples.
>
>Thanks guys
>
>Karlo
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


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


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


Current Thread