I have an extensive menu in which I would like to search for and manipulate menu items quickly. Is it possible to search for a list of ids, lets say something along the lines of
list contains ("0,57,19,22,30,31,32,33,34,36,45,53,63,58,59,23,24,25,26,27,28,29,37,38,39,40,41,42,43,44,46,47,48,50,51,52,54,55,16", "45")
example node:
<li class="standby" id="id61">
as of right now I am using a loop in cfscript
if(listLen(IdsToRemove.List,",") GT 1){
for(i=1;i lte listLen(IdsToRemove.List);i=i+1) {
valueToFind="li[@id='" & listGetAt(IdsToRemove.List,i) & "']";
findNode=XmlSearch(MyNavigation.myMenu,"//" & valueToFind);
Instance.UDFLibrary.XmlDeleteNodes(XmlDocument=MyNavigation.myMenu,Nodes=findNode);
}
}
I am really hoping to search for a list and delete all the nodes at once. thoughts?
You can use
contains()in xpath expressions to search through a string. If you treat that string as a list you can skip the outer loop.ids would be something like ” 0 57 19 ” and
concat(' ', substring(@id,3), ' ')would be something like ” 0 ” so the expression above is essentially a long-winded version of ListFind() using all but the first 2 characters of the nodes id.