In a related post, How to select specified node within Xpath node sets by index with Selenium?, it is mentioned that there is "no index i in xpath". I am trying to use an index in an R loop within an XPath expression such as
getNodeSet(xmlfile, '//first[i]/second/third')
Clearly, according to the above post it works perfectly when replacing 'i' with '1', but not e.g. for i <- 1
.
However, the workaround in the above post (i.e. using ['+i+']
) does not seem to work.
Any ideas on how to make indices work in XPath expressions?