Subject: [xsl] Passing parameters from ASP to XSL From: junx@xxxxxx Date: Sun, 18 Mar 2001 03:02:52 +0100 (MET) |
Hi there, I'm fairly new to XSL and ASP, too. After hours, I managed to transform a XML document into an HTML document using ASP and XSL. Now, I'm trying to pass a parameter from the ASP to the XSL-File (background: I have an article in the XML-File and I want to render only one page at a time to the browser, the parameter will specify which page). I've got two problems: First, I tried an example from the mulberry list archive, but it doesn't work from ASP-side. Set template=createObject("MSXML2.XSLTemplate") Set template.stylesheet=addRecordFilter Set processor=template.createProcessor processor.input=stubDoc for each qs in Request.QueryString() processor.AddParameter qs,Request.QueryString(qs) next In the second line of code, the processor says, that an object is needed. Second, I'm using PWE and MSXML3 to do the transformations. I used the namespace http://www.w3.org/TR/WD-xsl and it works fine, renders a ToC and highlights one of the items, selected by and constant integer (this will be replaced by the passed parameter, I thought): <?xml version="1.0"?> <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <HEAD> <LINK REL="stylesheet" TYPE="text/css" HREF="style.css"/> </HEAD> <BODY> <!-- CUT THE TOC FROM HERE ON --> <UL ID="toc"> <xsl:for-each select="article/chapter"> <LI> <xsl:choose> <xsl:when test="context()[2]"> <SPAN> <xsl:attribute name="class">subtitle_small_active</xsl:attribute> <xsl:value-of select="title"/> </SPAN> </xsl:when> <xsl:otherwise> <A> <xsl:attribute name="class">subtitle_small</xsl:attribute> <xsl:attribute name="HREF">#H<xsl:eval>formatIndex(childNumber(this),"1")</xsl:eval></xsl:attribute> <xsl:value-of select="title"/> </A> </xsl:otherwise> </xsl:choose> </LI> </xsl:for-each> </UL> <!-- TOC ENDS HERE --> </BODY> </HTML> I've read, that passing parameters are only working with the namespace http://www.w3.org/1999/XSL/Tranform, but if I change the namespace to this, it says, that I cannot use HTML within this namespace. If I use <xsl:param> within the namespace given in the sample source above, it says, that I may not use the <xsl:param>. Frustrating, I think. I think, I need a good pointer into the right direction now. What do I have to change to insert a param into the xsl and how do I add the parameter's value from the ASP's side? Any examples on the web that will run on my Personal Web Server and MSXML3? I have to use these tools because of an assessment for my university. Any comments are highly appreciated yours Sebastian Will -- Sent through GMX FreeMail - http://www.gmx.net XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] specifying a target for a, Jeni Tennison | Thread | RE: [xsl] Passing parameters from A, Newman, Todd |
RE: [xsl] dash, David Santamauro | Date | Re: [xsl] Functional programming in, Joe English |
Month |