I have a cascading select for locations and sub-locations. Not all locations have a sub-location and if that is the case, I want to use relevant to hide the sub-location question. Is there a way to do this?
I tried what is described in the post linked below, but it seems to always count the total number of sub-location options, not the length of the filtered list. count_filtered_cascade_options.xlsx (16.2 KB)
BTW, now that all choice lists in XLSForms are converted to nodesets (see https://github.com/XLSForm/pyxform/pull/614) there is no longer any need for circa 2019 'tricks' to accomplish this.
So as @ahblake most astutely states, you just need to perform a little XPath 'black magic' to include the equivalent cascading select filter into your count() input nodeset. Yes it is a bit obscure, but there is tremendous (hidden) power in these XPath expressions that let you accomplish magical things like this!
Your question suggests that it's not working as expected. The intent would be for no modification to be needed but it's possible there's an issue there because it is more complex. Can you show an example of what's not working?
EDIT: I was mistakenly referring to the question name and not the external file inside the instance('...') part of it. This file shows what wasn't working, it has my mistake: counting_options_length.xlsx (14.5 KB)