How to test if one value is existed in a couple of values?
I use
<xsl:variable name="nodes" select="$currentPage/ancestor-or-self::*[@isDoc and @level='1']//*[@isDoc and umbraco.library:Split(tags,',')//value=$currentPage/descendant-or-self::*[@isDoc and isTag='1']/@id]"/>
this xsl will select some nodes which tags field value is include some nodes id of currentpage//*
But it's very slow.
I want to try Razor, Who can give me one Razor example.
How to test if one value is existed in a couple of values?
I use
<xsl:variable name="nodes" select="$currentPage/ancestor-or-self::*[@isDoc and @level='1']//*[@isDoc and umbraco.library:Split(tags,',')//value=$currentPage/descendant-or-self::*[@isDoc and isTag='1']/@id]"/>
this xsl will select some nodes which tags field value is include some nodes id of currentpage//*
But it's very slow.
I want to try Razor, Who can give me one Razor example.
I think you could either use plain C# :
foreach(var node in Model)
{
if(node.Level == "1" && node.getProperty("isTag") == "1")
{
//do stuff
}
}
or use lambda:
foreach(var node in Model.Where(x=>x.Level == "1").Where(x=>x.getProperty("isTag") == "1")
{
// do stuff
}
Actually I think a better solution would be:
foreach(var node in Model.Where(x=>x.Level == "1" :
x.getProperty("isTag" == "1")
{
// do stuff
}
The main problem is how to do following wit razor:
umbraco.library:Split(tags,',')//value=$currentPage//*[@isDoc]/@id
If tags is a property you should be able to use .Split[','] in Razor?
is working on a reply...