Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 935063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:05:59+00:00 2026-05-15T21:05:59+00:00

can array’s be created and used in xslt? If so are there suitable examples

  • 0

can array’s be created and used in xslt? If so are there suitable examples online to study? If not is there a way to store values in a way that mimics an array?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:06:00+00:00Added an answer on May 15, 2026 at 9:06 pm

    With XSLT 2.0 you can model any data type you want to.

    As 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>
    

    With any input, output:

    B
    

    In XSLT 1.0 there is not Temporaly Result Tree data type. There is a Result Tree Fragment data type that does not allow node-set operator. So, the only way to go is with extensions functions: in this case node-set() from EXSLT (MSXSL has a built-in node-set() extension, also).

    So, in XSLT 1.0 without extensions you can have only inline data model, or by params or by external document. As example:

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

    Result, with any input:

    B
    

    Only if you want to, I can provide you a XSLT 1.0 plus extensions example (It’s not standar…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way where overwritting of the array can be avoided? In my
how can an array be created that randomizes results from 3 different values 0,1,2
Is there a limit to the number of elements a Java array can contain?
can array be used as hidden variable on jsp.....like I have a form i.e
Before I sort I can access array values by key correctly. var a=[]; a['1']={'id':'1','aaa':'xxx'}
Is there a similar function like in_array() but that can check array keys, instead
is there a good function that can combine array by key ? ( in
{assign var=tmp_url value=setURI(array('page' => 1))} It seems array() can't be used in smarty ?
Can PHP array passed POST method to catch in ASP.NET MVC? Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3
A PHP array can have arrays for its elements. And those arrays can have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.