passing param to XSLT
In the following code sample, I am trying to pass a value into my XSLT, but I get the error:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[object]'
The error is occurring on the line between the two commented lines saying '*** ERROR ***
dim objXMLDoc
dim objXSLDoc
dim strXMLDoc
dim strXSLDoc
dim strResults
dim Cnt
dim Location
dim Path
dim strHTTP
dim String1
dim strLeft
dim strRight
dim XSLParam
dim ItemToView
const PROG_ID = "Microsoft.XMLDOM"
'Get the XML file name from the Request object
strXMLDoc = server.mappath(request("XML"))
'Get the XSL file name from the Request object
strXSLDoc = server.mappath("./Browse.xsl")
Path = request("Path")
ItemToView = request("Item")
strHTTP = chr(34) & "http://" & chr(34)
if err.number = 0 then
'Parse the XML Document
set objXMLDoc = server.CreateObject(PROG_ID)
objXMLDoc.async = false
objXMLDoc.load(strXMLDoc)
if objXMLDoc.parseError.errorCode = 0 then
'Parse the XSL style sheet
set objXSLDoc = server.CreateObject(PROG_ID)
objXSLDoc.async = false
objXSLDoc.load(strXSLDoc)
set XSLParam = objXSLDoc.selectSingleNode("//xsl:param[@name='ItemToView']")
'*** ERROR ***
XSLParam.childnodes(0).nodevalue = ItemToView
'*** ERROR ***
if objXSLDoc.parseError.errorCode = 0 then
'If no errors, transform the XML
'into HTML using the XSL style sheet
strResults = objXMLDoc.transformNode(objXSLDoc)
else
strResults = "The following error " & _
"occurred while " & _
"processing the XSL " & _
"stylesheet: <br>" &_
objXSLDoc.parseError.errorCode & _
", " & _
objXSLDoc.parseError.reason
end if
else
Here are the first few lines of my XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:did="urn:mpeg:mpeg21:2002:01-DIDL-NS" >
<xsl:param name="ItemToView" select="'1'" />
<xsl:template match="/">
|