|
Subject: Re: [xsl] Passing a variable number of parameters or rather an array From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> Date: 20 Apr 2005 15:12:25 +0100 |
>>>>> "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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Passing a variable number, kent | Thread | RE: [xsl] Passing a variable number, kent |
| Re: [xsl] Passing a variable number, Ramkumar Menon | Date | Re: [xsl] XSL-FO & Selecting Attrib, craig webber |
| Month |