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

  • SEARCH
  • Home
  • 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 6955987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:48:32+00:00 2026-05-27T14:48:32+00:00

I have never really used XSLT before and am looking for some advice. I

  • 0

I have never really used XSLT before and am looking for some advice.

I have the following items returned in XML from GSA box:

<MT N="searchCategories" V="Category 1"/>
<MT N="searchCategories" V="Category 2"/>
etc etc

There can be any amount of these categories.

I am just wondering if XSLT has any concept of an array?

If so:

  • How could I enumerate all the nodes above into an array?
  • How would I get the length of the array?

If not:

  • Is there any work around available?

I believe I am using XSLT version 1.0

  • 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-27T14:48:33+00:00Added an answer on May 27, 2026 at 2:48 pm

    As explained by @Michael Kay, there is no array data structure supported by the XPath data model (XDM) both for XPath 1.0 and XPath 2.0.

    However, it is possible to use an array-like syntax like this:

    In XPath 1.0/2.0 one can define a variable to contain a specific set of nodes and these can be accessed by their position (in document order), specifying this position in a predicate.

    Here is an example:

    <xsl:variable name="vTransfers" select="/*/transfer"/>
    

    defines a variable named vTransfers with value the node-set of all transfer elements each of which is a child of the top element of the XML document.

    Then:

    $vTransfers[1]
    

    selects the first element that is contained in $vTransfers.

    $vTransfers[2]
    

    selects the second element that is contained in $vTransfers, …

    $vTransfers[position() = $k]
    

    selects the node from $vTransfers whose position, in document order, is equal to the value contained in the variable $k.

    In addition XPath 2.0 supports the concept of sequences. A sequence is like a list of items. An item can be of any type — not only node. The items in a sequence are ordered in the way they appear (are defined) in the sequence. If two items in a sequence are nodes, their order is still that defined in the sequence and this may be different from their document order.

    Example:

    <xsl:variable name="vNumList" as="xs:integer*" select="3, 5, 7"/>
    

    then when referenced like this:

    $vNumlist[2]
    

    produces:

    5
    

    Remember: Although these synthactic constructs resemble selection of an item from an array, node-sets and sequences are not arrays. In particular, they typically lack the very fast access O(1) that an array has to its elements. In the case of node-sets and sequences the efficiency of accessing an item at a random position is typically O(N). This means that an algorithm that is O(N) when using an array, may be O(N^2) when using the array-like notations with node-sets or sequences.

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

Sidebar

Related Questions

G'day, I have never really used excel formulas before but need to convert a
I have never used Foxpro before. Can you convert the following Foxpro code into
I have experience with C++ but I've never really used Qt before. I'm trying
I've never really used MS server or anything like that before, i have, however
I am a mac user and have never really used a pc from the
I've never really used threading before in C# where I need to have two
I have never used jQuery before and I'm trying to do something really simple
I've never really used the DOM parser before and now I have a question.
I have never used floats really that much before and the current project I
I have never really used regular expressions all that much and as such i

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.