I need to get a sublist of this list with only the item that have an exemplesNode set to 1336 . I need this so I can count how much element I have, and take a decision how to show it on my page (template will be different if there's is 0 of them).
How can I make a select statement that will generate what I want?
Hmm..where are you putting the above code? If you put it in a value-of it will only show the first, but in a variable it would work. Maybe paste a bit more of your code
Filter a list of elements
Hello,
I have a list of elements, let's say it look like this :
<items>
<item>
<data alias="exemplesNode">1336</data>
<data alias="imageUrl">1105</data>
</item>
<item>
<data alias="exemplesNode">1336</data>
<data alias="imageUrl">1106</data>
</item>
<item>
<data alias="exemplesNode">1337</data>
<data alias="imageUrl">1106</data>
</item>
</items>
I need to get a sublist of this list with only the item that have an exemplesNode set to 1336 . I need this so I can count how much element I have, and take a decision how to show it on my page (template will be different if there's is 0 of them).
How can I make a select statement that will generate what I want?
Thank you in advance!
This should do it:
Then you can do something like:
-Tom
Hello,
Thanks! But I think that there is a problem. Here is the complete expression :
"$currentPage/exempleImagesList/items/item [data[@alias = 'exemplesNode'] = '1336']"
But when using it, it's seems to search only in the first child "item". So it only returns the first node, but not the second.
Do you know a fix for this?
Thanks again!
Hmm..where are you putting the above code? If you put it in a value-of it will only show the first, but in a variable it would work. Maybe paste a bit more of your code
Hi,
Sorry for my late respond.
You are right! When I put the value of this variable in a for-each, it works! Thanks a lot!
is working on a reply...