Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2006, 06:17 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass multiple values to XSL?

Hi,
Does anyone know how (if) this can be done:

I use asp (vbscript), XML and XSLT to generate HTML output to browsers. One this page I need to list files in a directory on the server. If this was a asp (classic) page I´d simply do this using FileSystemObject, but how do I go about to list the files in XSLT?

I use xsl:addParameter often to pass values to my XSL pages, but in this case where the number of filenames are unknown I cannot see that this is an option.

Any pointers or ideas? Anything is very much appreciated.

/Micke

 
Old March 16th, 2006, 06:33 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can construct an XML document containing the list of filenames and pass that XML document as a parameter.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 16th, 2006, 07:04 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael Kay, a very big thank you from snowy Sweden. I didn´t know that was possible - I´ll check into this immediately. Again, thanks!

:)

 
Old March 17th, 2006, 09:13 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Seems I don´t understand how to do this anyway...

If I simply create a node set in a variable and pass it to my XSL using addParameter in vbscript, and catch it inside XSL with xsl:param, then I cannot extract the different file names since the node set now seems to be treated as any text string inside XSL?

If I do:
<xsl:value-of select="$filesXML" />

I get:
<file_name>file1.doc</file_name><file_name>file2.doc</file_name>

And if I try:
<xsl:value-of select="$filesXML/file_name[1]" />
Or other ways to try to get node values, I get the error:

msxml4.dll error '80004005'
Reference to variable or parameter 'filesXML' must evaluate to a node list.

I´ve spent hours googling around for pointers, but I simply cannot get this to work.

I´ve tried using 'msxsl:node-set' as well, but without any luck :(

Any pointers? I´m tearing my hair out over this one (soon going bald...).

 
Old March 17th, 2006, 09:25 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It looks to me as if you are passing in a string containing unparsed XML, rather than a tree containing parsed XML.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 17th, 2006, 11:16 AM
Registered User
 
Join Date: Feb 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That was indeed it. Making sure I sent a parsed xml fragment and using the msxsl:node-set extension did it.

A big thank you again






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass multiple values in one parameter yasinirshad Crystal Reports 0 June 3rd, 2008 02:58 AM
pass multiple values to 1 parameter in Crystal 10 ckwizard77 Crystal Reports 0 July 26th, 2007 01:54 PM
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
How to pass multiple values from Crystal Report to vanitha Crystal Reports 2 June 5th, 2007 07:48 AM
Passing multiple values to a pass- through query donnie200 Access VBA 2 July 7th, 2005 04:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.