-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get index position as value while doing do list
#349
Comments
It could also be solved in a more complex way with a math function which is requested in #350 |
Can you clarify what the actual use case is? Why do you need the position? |
Transforming data to mets and creating a structural reference within the metadata based on the position within the transformation. https://stackoverflow.com/questions/4449810/using-position-function-in-xslt |
i thought I have a workaround, but this not to be working: would be a complex solution for this:
This results in:
Results in
So almost. This seems to be connected to #239 |
Clever idea ;) Yes, you have to do it in each iteration instead of once at the end: set_array("animals[]")
set_array("animals_index")
do list(path: "a[]", "var": "$i")
copy_field("$i", "animals[].$append.name")
# keep track of items (globally)
copy_field("$i", "animals_index.$append")
# determine current count (locally)
set_array("animals[].$last.pos")
copy_field("animals_index", "animals[].$last.pos.$append")
count("animals[].$last.pos")
end
retain("animals[]") |
For a hbz project we need the option to state the position of an value within an array, e.g. while doing
do list
.There are three ways I can think of how to manage this:
a) a function
index_position
that adds/creates an element with the position while iterating over an list:input:
input:
input:
The text was updated successfully, but these errors were encountered: