Hey everyone, I have a whole bunch of nodes that I want to filter based on a querystring. Rather than build a bunch of nested "for-each" loops, I figured it would be better to build a condition dynamically and pass that to my select. Here is what I have so far:
<xsl:variable name="SearchFilter">data[@alias='Product_Type'] = 'Retail'</xsl:variable> ... more code to customize SearchFilter ..
<xsl:for-each select="umbraco.library:GetXmlAll()/descendant-or-self::node[$SearchFilter]"> ... code to display remaining nodes ... </xsl:for-each>
Just in case anyone is curious, after much research and head banging, I think I have concluded that what I was trying to do cannot be done. I've seen it done on simple conditions that do not contain logic. ([@level=$level]) But not with statements like the one I was trying to include. (ie: The comparison data[@alias='Product_Type'] = 'Retail') I tried creating subtemplates and quite a few other options with the same results every time. I finally ended up solving the problem with what I feel is an inelegant solution using a really complicated "AND/OR" statement. (Note: I'd be happy to post the code if someone wants to see it but, like I said, it's pretty ugly.)
If anyone knows of a way to do this or if there is trick I haven't tried, please feel free to post here. If I find something, I will do the same.
Dynamically build for-each condition
Hey everyone, I have a whole bunch of nodes that I want to filter based on a querystring. Rather than build a bunch of nested "for-each" loops, I figured it would be better to build a condition dynamically and pass that to my select. Here is what I have so far:
Does anyone have any ideas to get this to work?
Thanks!
Just in case anyone is curious, after much research and head banging, I think I have concluded that what I was trying to do cannot be done. I've seen it done on simple conditions that do not contain logic. ([@level=$level]) But not with statements like the one I was trying to include. (ie: The comparison data[@alias='Product_Type'] = 'Retail') I tried creating subtemplates and quite a few other options with the same results every time. I finally ended up solving the problem with what I feel is an inelegant solution using a really complicated "AND/OR" statement. (Note: I'd be happy to post the code if someone wants to see it but, like I said, it's pretty ugly.)
If anyone knows of a way to do this or if there is trick I haven't tried, please feel free to post here. If I find something, I will do the same.
Thanks again!
Dygfloyd, could you elaborate a bit on what your input is, and what you actually want to aquire - maybe a couple of examples of your SearchFilter ?
is working on a reply...