selectSingleNode from a relative position
-
Is there a way to specify a search root to selectSingleNode? it always gives me the first hit in the file even if the Node that is calling the function is located after the node that gets found. for example, in file __
____1<\Item> __ __
____2<\Item> __
(for some reason the opening Item tags dissapear when i post) How should I Locate Item 2(In c++) without using child or nextsibling pointers(I cant guarantee the order of the child Items)
-
Is there a way to specify a search root to selectSingleNode? it always gives me the first hit in the file even if the Node that is calling the function is located after the node that gets found. for example, in file __
____1<\Item> __ __
____2<\Item> __
(for some reason the opening Item tags dissapear when i post) How should I Locate Item 2(In c++) without using child or nextsibling pointers(I cant guarantee the order of the child Items)
Sorry but that is what selectSingleNode does, return the first node that matches the criteria. You could and the value you are looking for (2) to search string. "forms/form/2" (wrong syntax I know but you get the idea), possibly "forms/form/position() == 2" might work.
-
Sorry but that is what selectSingleNode does, return the first node that matches the criteria. You could and the value you are looking for (2) to search string. "forms/form/2" (wrong syntax I know but you get the idea), possibly "forms/form/position() == 2" might work.
-
So does that mean there is no search function that allows you to enter a starting point to search from? I'm not familiar with position(). Except that it is XSL and I do not have a stylesheet. Is it possible to use the XSL funtions without that?
Oops. I take my previous posting back :-). You should be able to create an XPATH with the position() function. position is an XPATH function that maybe be used in an XSLT. So you just need to create the correct XPATH. Though position is used when you are in a loop. So using it directly will not help. Instead in your case it would be something like Forms/Form/Item[2] or Forms/Form[2]
-
Oops. I take my previous posting back :-). You should be able to create an XPATH with the position() function. position is an XPATH function that maybe be used in an XSLT. So you just need to create the correct XPATH. Though position is used when you are in a loop. So using it directly will not help. Instead in your case it would be something like Forms/Form/Item[2] or Forms/Form[2]