[XSL] : use array variable in XSL stylesheet

Discussion in 'XML' started by MC, Mar 24, 2005.

  1. MC

    MC Guest

    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
    MC, Mar 24, 2005
    #1
    1. Advertising

  2. MC <> writes:

    > 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
    David Carlisle, Mar 24, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=

    Stylesheet referanse i stylesheet

    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=, Jul 3, 2004, in forum: XML
    Replies:
    3
    Views:
    557
    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=
    Jul 4, 2004
  2. Steven An
    Replies:
    1
    Views:
    486
    Martin Honnen
    Nov 23, 2004
  3. Thomas Sommer
    Replies:
    0
    Views:
    418
    Thomas Sommer
    Nov 25, 2004
  4. David Blickstein
    Replies:
    3
    Views:
    1,018
    David Blickstein
    Aug 2, 2005
  5. Replies:
    0
    Views:
    514
Loading...

Share This Page