[xml] XPath Location Path



Hi

Gone back to playing with XPath today.

I'm probably showing up gaps in my understanding of XPath here, but could
you confirm that the following is a bug in libxml, please?

 I'm using the following simple test xml :
<?xml version="1.0"?>
<el1>
  <el2>
    <el3>
    </el3>
  </el2>
</el1>

Using this in testXPath with the expression "name(el2)" it returns "el2".
Both "name(el1)" and "name(el3)" return an empty string

If I understand the spec correctly, I'd think that as el1 is the root node,
"name(el1)" should return "el1" and "name(el2)" should return an empty
string, i.e. it assumes that the context node is the first child of the root
node, and not the root node itself.

I've tested this with a fresh install of libxml2.2-4-19 just to make sure
that none of my previous dips into the XPath source code have messed
anything up.

If you're happy it's a bug, I'll send a patch for it.

Thanks,
Richard





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]