Create an array in xslt


You can create any data type model you want to in xslt.

To create an array, just create a variable for it.

Example:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" omit-xml-declaration="yes"/>
 
    <xsl:variable name="array" as="element()*">
        <Item>A</Item>
        <Item>B</Item>
        <Item>C</Item>
    </xsl:variable>
 
    <xsl:template match="/">
        <xsl:value-of select="$array[2]"/>
    </xsl:template>
 
</xsl:stylesheet>

Output

B

Advertisement

6 thoughts on “Create an array in xslt”

  1. It's a shame you don't have a donate button! I'd definitely donate to this brilliant blog!
    I guess for now i'll settle for book-marking and adding your
    RSS feed to my Google account. I look forward to fresh updates and will share this website with my Facebook group.
    Chat soon!

    my homepage … Meir Ezra Coach

    Liked by 1 person

  2. Excellent site. Plenty of helpful information here.
    I am sending it to some friends ans additionally sharing in delicious.
    Andd obviously, thnks on your effort!

    my web blog … Bob Duggan

    Liked by 1 person

  3. Hey there! Quick question that's entirely off
    topic.Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone. I'm trying to find a theme or
    plugin that mmight be able to resolve this problem.
    If you have any recommendations, please share.
    Appreciate it!

    Feel free to visit my page :: Meir Ezra

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: