XML How to set attribute from a nodelist
I have a node list created that produces a list of nodes that have an attribute named "ObjectRef" and where its value is > 25
EG
Set ObjNodeList = xmlDoc.documentElement.selectNodes("//PremiereData/*[@ObjectID>='23']/descendant::*[@ObjectRef>='25']")
I need to update the value for "ObjectRef" for every node in the nodelist. Sometimes this node has this attribute only and other nodes have an attribute named "IndexID" also. If so, "ObjectRef" is always the second attribute. These nodes selected can be 2nd, 3rd or 4th descendants.
I am trying the following Xpath but it does not work.
Code:
For I2=objnodelist.length-1 to 0 step -1 'Have to go backwards, the values are sequential
Set root = root.selectSingleNode("//" & ObjNodeList.Item(I2).nodeName & "/descendant::*[@ObjectRef>='25']")
root.setattribute "ObjectRef" "nn" + n1
next I2
Thanks in advance
Re: XML How to set attribute from a nodelist
OK,
This fixed it
Set root = root.selectSingleNode("//" & ObjNodeList.Item(I2).nodeName & "[@ObjectRef>='25']"
Thanks for looking