|
Subject: Re: [xsl] Problem passing parameter ASP -> XSL From: <mfreeman@xxxxxxxxxxxx> Date: Tue, 25 Jul 2006 8:25:50 -0400 |
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: [xsl] 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¶mVal2=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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Problem passing parameter ASP, Garry Searle | Thread | RE: [xsl] Problem passing parameter, Garry Searle |
| [xsl] Problem passing parameter ASP, Garry Searle | Date | RE: [xsl] Problem passing parameter, Garry Searle |
| Month |