[XSL] : use array variable in XSL stylesheet

M

MC

Hi to all,

I would like to use in a XSL stylesheet an array variable which is
defined in a Java program.

For example, in my program, i defined a tab variable
String[] tab = {"first", "second", "third"};

which i pass to the XSLT processor like this :
transform.setParameter("tab", tab);

In my XSL stylesheet, i declare tab variable with <xsl:param
name="tab"/> and I would like for example to get the second element of
the tab.

Is it possible ? I try <xsl:value-of select="$tab[1]"/> but I've an error.

More generally, is it possible to use in XSL stylesheet arrays objects,
Hashmap, .. and JavaBeans ?

Thanks a lot for your answers

Marie
 
D

David Carlisle

MC said:
Hi to all,

I would like to use in a XSL stylesheet an array variable which is
defined in a Java program.

For example, in my program, i defined a tab variable
String[] tab = {"first", "second", "third"};

which i pass to the XSLT processor like this :
transform.setParameter("tab", tab);

In my XSL stylesheet, i declare tab variable with <xsl:param
name="tab"/> and I would like for example to get the second element of
the tab.

Is it possible ? I try <xsl:value-of select="$tab[1]"/> but I've an error.

More generally, is it possible to use in XSL stylesheet arrays objects,
Hashmap, .. and JavaBeans ?

Thanks a lot for your answers

Marie


The mapping between types in the external system and types within XSLt
is purely a feature of the system you are using (you don't say which
that is), so it depends on that system. Generally though, especially if
you want to use [1] notation, I'd have thought that you would have a
better chance of things working smoothly if you construct a tree
structure (DOM of some sort) in the external code first and then rely on
the API's mapping of external DOM fragments to Xpath node sets.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top