RE: [xsl] Asp Variable into XSLT

Subject: RE: [xsl] Asp Variable into XSLT
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Wed, 13 Jun 2001 14:25:08 +0100
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


Current Thread