DynamicNodeList d = homePage.DescendantsOrSelf();
//NextNode
//GetDescendants descendants that are available (firstOne)
\
@foreach (DynamicNode item in d)
{
<li><a title="@item.GetPropertyValue(" href="http://mce_host/forum/developers/razor/@item.Url/simpledoc">@item.Name : @item.Id</a></li>
}
looks pretty simple... however, they enumerate the nodes differently :-(
xslt follows the site hierarchy... razor doesn't but renders all children of node before then looping though each child to render there children...
DynamicNodeList d = homePage.DescendantsOrSelf();
DynamicNodeList d = homePage.XPath("descendant-or-self::*");
whilst looking the same produce different enumerations the top one we are as said before loops though children, then their children etc..
the second one goes down the heirachy child, has children? etc before moving on to the next sibling (as the xslt of old).
But there is a 10x performance hit... on a small set of nodes <50 (this is looking just at the execution time for the macro in the debugtrace)
[Done Executing Macro Script (file: Scratch) from last in s]
incorrect order .DescendantsOrSelf(); 0.014s
correct order .XPath("descendant-or-self::*") 0.11s !!!
and as far as I can tell the same in xslt 0.003s!!!!!
Starting to wonder why I'm recoding to razor.... yes it's easier to read and prob the way forward with mvc on the horizon... but it's painful when it's not replicating expected structures.
xslt to razor conversion issues... order of enumeration of descendants...:-(
so I have a simple get descendants...
from xslt
razor
looks pretty simple... however, they enumerate the nodes differently :-(
xslt follows the site hierarchy... razor doesn't but renders all children of node before then looping though each child to render there children...
eg
xslt
Did some more digging...
and
whilst looking the same produce different enumerations the top one we are as said before loops though children, then their children etc..
the second one goes down the heirachy child, has children? etc before moving on to the next sibling (as the xslt of old).
But there is a 10x performance hit... on a small set of nodes <50 (this is looking just at the execution time for the macro in the debugtrace)
[Done Executing Macro Script (file: Scratch) from last in s]
incorrect order .DescendantsOrSelf(); 0.014s
correct order .XPath("descendant-or-self::*") 0.11s !!!
and as far as I can tell the same in xslt 0.003s!!!!!
Starting to wonder why I'm recoding to razor.... yes it's easier to read and prob the way forward with mvc on the horizon... but it's painful when it's not replicating expected structures.
is working on a reply...