Is there an index token in the Repetition statement of the Variable Substitution Syntax?

According to the documentation at, a variable can be used to perform a repetition of substitutions but there is no way to obtain a position or index value to use during the iteration. So lets say I have the following variable:

Name: URLs

And given the following transformation:

#{each url in URLs}
    <add key="**#{index}**" value="#{url}" />

I would expect an ouput like:

    <add key="0" value="" />
    <add key="1" value="" />
    <add key="2" value="" />

Is there such a placeholder that could be used for this purpose?

Hi Rmardeni,

Thanks for getting in touch! You can use the Iterating over sets of values feature outlined in that document. In your case, you variables would look something like this:

Name                   Value

And the transformation:

#{each url in Urls}
    <add key="#{url}" value="#{url.Value}" />

Hope that helps!

Robert W

Hi Robert,

Thanks for the reply, I had not noticed that the value between parenthesis was available; however this approach yields a large number of variables in the context that I am using it.

I have 4 URLs that are different per environment and we have a total of 13 different environments, so this approach requires a total of 52 variables instead of just 13 variables.

I noticed that OctoStache uses the Sparce library and that there are other values that could be made available for the purpose of transformations to have more flexibility like the one I am mentioning. I will add it as a suggestion to the roadmap.

Hi Rmardeni,

Is there some sort of pattern to the URLs? For example you could have the variables:

Name                   Value                                                            Scope
Customer              alice                                                            Test
Urls[1].Value         #{Customer} 
Urls[2].Value         #{Octopus.Environment.Name}

Robert W

Certainly not something I can use to greatly reduce the number of variables.