xsl-list
[Top] [All Lists]

Passing parameters from ASP to XSL within a for-next block

2003-02-11 09:43:33

I have a simple ASP function to transform a XML
document using parameters. It works pretty well, but
when I use it within a for-next block it works only
for the first iteration. It returns an empty string
for the others.

This is the function:

function transformXML(param1, param2, param3)
        dim xml, xsl
        dim proc, XSLTemplate

        'put the XML in an object
        Set xml =
Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
        xml.async = False
        xml.load xmlPath

        'load the XSL into an object
        Set xsl =
Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
        xsl.async = False
        xsl.load xslPath
        
        'add parameters to the xsl
        Set XSLTemplate =
Server.CreateObject("MSXML2.XSLTemplate")
        Set XSLTemplate.stylesheet = xsl

        Set proc = XSLTemplate.createProcessor

        'set the source of the data
        proc.input = xml
        
        proc.addParameter "param1", cstr(param1)
        proc.addParameter "param2", cstr(param2)
        proc.addParameter "param3", cstr(param3)
    
        proc.Transform
        transformXML = proc.output

        'clean up
        set xml = Nothing
        set xsl = Nothing
        set proc = Nothing
        set XSLTemplate = Nothing
end function

And how I'm calling it:

for i = lbound(myArray) to ubound(myArray)
        Response.write transformXML("x", "y", myArray(i)
next

Any ideas why it's not working?

Kind regards,
Nadia


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>