[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing a variable number of parameters or rather

Subject: Re: Passing a variable number of parameters or rather an array
From: António Mota <amsmota@xxxxxxxxx>
Date: Wed, 20 Apr 2005 15:54:50 +0100
java variable number of parameters
If i remember correctly, i've done some passing by using a node
constructed in, and passed by, Java without any problem.

Then in Javascript i couldn't pass a node to the xsl, so i've passed
as a string and the use substring(...) cause the length of the
individual "parameters" is equal. Then theres the problem of iterate,
if you have a fixed numbers of  individual "parameters" you can use
something like creating a dummy node-set with that number (say three)


and then use a xsl:for-each on it and access the parsed strings in it.

Probably i didn't explain myself clear, i'm not a expert neither in
XSL neither in English.

If you want i try to clarify with a example.

On 4/20/05, kent <kent@xxxxxxxxxxxxxxxxx> wrote:
> Also a good idea, but do I have to go and save the xml as a file, is there
> no way of passing in the it in also as a parameter, performance is not a
> huge issue, but I wouldn't mind saving a bit of disk latency.
> More importantly how do I do array/string[1] in some sort of loop, sorry I
> am very new to xslt.
> thanks
> -----Original Message-----
> From: Colin Paul Adams [mailto:colin@xxxxxxxxxxxxxxxxxx]
> Sent: Wednesday, April 20, 2005 3:12 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Passing a variable number of parameters or rather an
> array
> >>>>> "kent" == kent  <kent@xxxxxxxxxxxxxxxxx> writes:
>     kent> I have had a trawl on this subject, but I the best answer I
>     kent> can get is 'You can pass a nodeset, which can be treated as
>     kent> the XML equivalent of an Array'.  However I am not sure how
>     kent> to create the nodeset, pass it, and then deal with it in the
>     kent> stylesheet.
>     kent> I would like to pass an array of strings to the
>     kent> stylesheet. Does anyone have an example of doing this, or
>     kent> know where one is. I looked at xalan examples and none of
>     kent> the examples seem to fit, plus I can't find one anywhere
>     kent> else.
> The details of how to pass stylesheet parameters to a transformer is
> specific to the particular XSLT processor.
> But there is a portable (*) way of doing what you want to do:
> Create your array as an xml document: e,g.:
> <array>
>  <string>string one</string>
>  <string>string two</string>
> </array>
> Then pass the URI of this document as a string-valued parameter, and
> use the document() function to access the array.
> Now you can use XPath expressions such as array/string[1] to get the
> first string-value from this document.
> (*) assuming that all XSLT processors allow you to pass a
> string-constant as a parameter.
> --
> Colin Paul Adams
> Preston Lancashire

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.