src/xpath.js
function fallbackResolve(path, root) {
  let steps = path.split("/")
  let node = root
  while (node) {
    let step = steps.shift()
    if (step === undefined) break
    if (step === '.') continue
    let [name, position] = step.split(/[\[\]]/)
    name = name.replace('_default_:', '')
    position = position ? parseInt(position) : 1
    node = findChild(node, name, position)
  }
  return node
}
function fallbackResolve(path, root) {
  let steps = path.split("/")
  let node = root
  while (node) {
    let step = steps.shift()
    if (step === undefined) break
    if (step === '.') continue
    let [name, position] = step.split(/[\[\]]/)
    name = name.replace('_default_:', '')
    position = position ? parseInt(position) : 1
    node = findChild(node, name, position)
  }
  return node
}
function fallbackResolve ( path , root ) { let steps = path . split ( "/" ) let node = root while ( node ) { let step = steps . shift ( ) if ( step === undefined ) break if ( step === '.' ) continue let [ name , position ] = step . split ( / [\[\]] / ) name = name . replace ( '_default_:' , '' ) position = position ? parseInt ( position ) : 1 node = findChild ( node , name , position ) } return node }
Find a single node with XPath `path` using the simple, built-in evaluator.
Find a single node with XPath path using the simple built - in evaluator .