xsl-list
[Top] [All Lists]

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

2003-02-11 09:56:17
Seems like an asp problem so not one to address here, but I did notice
that transformXML("x", "y", myArray(i) is missing a closing ) of course
you probably have that in your code so...

I'm also supposing that xmlpath and xslpath are dimensioned somewhere
outside the function cause I don't see them offhand. Other than that
it's been a while since I've hand to work with a vbscript array so I
can't help there.

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Nadia
Karasawa
Sent: Tuesday, February 11, 2003 5:44 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Passing parameters from ASP to XSL within a for-next
block


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



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



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