[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem passing parameter ASP -> XSL

Subject: Re: Problem passing parameter ASP -> XSL
From: <mfreeman@xxxxxxxxxxxx>
Date: Tue, 25 Jul 2006 8:25:50 -0400
vbscript parameter
try xslProc.addParameter ("paramVal1", paramVal1)

add the parenthesis.  This may work for you.


> 
> From: "Garry Searle" <garry@xxxxxxxxxxxxxxxxxx>
> Date: 2006/07/25 Tue AM 08:12:28 EDT
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Subject:  Problem passing parameter ASP -> XSL
> 
> Hi
> 
> I'm putting together my first xml-xsl together and have just one problem. I
> cant seem to get a parameter to work. I'm wanting to pass the parameter from
> an .ASP page.
> 
> I am calling this page with:  showStage.asp?paramVal1=test&paramVal2=12
> and the full ASP and XSL documents are below.
> 
> I set a default paramter which displays, but the passed parameter is blank.
> 
> I'd appreciate any feedback.
> 
> Thanks
> Garry
> 
> 
> 
> SHOWSTAGE.ASP
> =============
> 
> <%@ LANGUAGE="VBSCRIPT" %>
> <% option explicit %>
> <% Response.Buffer=True %>
> <%
>   Dim objXML, objXSL, xslTemplate, xslProc, paramVal1, paramVal2
> 
>   set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
>   objXML.async = false
>   objXML.load(Server.MapPath("StageInfo.xml"))
> 
>   set objXSL = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
>   objXSL.async = false
>   objXSL.load(Server.MapPath("Stage.xsl"))
> 
>   set xslTemplate = Server.CreateObject("MSXML2.XSLTemplate")
>   xslTemplate.stylesheet = objXSL
>   set xslProc = xslTemplate.createProcessor()
> 
>   paramVal1 = Request.querystring("paramVal1")
>   if paramVal1 <> "" then
>     xslProc.addParameter "paramVal1", paramVal1
>   end if
> 
>   paramVal2 = Request.querystring("paramVal2")
>   if paramVal2 <> "" then
>     xslProc.addParameter "paramVal2", paramVal2
>   end if
> 
>   xslProc.input = objXML
>   xslProc.transform()
>   Response.Write(xslProc.output)
> %>
> 
> STAGE.XSL
> =========
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
> 
> <xsl:template match="/">
> <xsl:param name="paramVal1" select="'default 1'"/>
> <xsl:param name="paramVal2" />
> 
> <html>
> <body>
>   <xsl:value-of select="$paramVal1" />           <----- shows "default 1"
>   <xsl:value-of select="$paramVal2" />           <----- doesn't show
> anything
> </body>
> </html>
> 
> </xsl:template>
> </xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.