Consider this a bad case of cut'n paste. The doc for within_element is from the original XML::Parser::Expat method. In fact this method should only be used during the parsing, if you are using the twig_roots option, to get information about the original document, not the view on it defined by twig_roots... if that makes any sense.
Basically you should use $elt->ancestors( $gi) in scalar context to getthe number of ancestors of type $gi for the element $elt. Which does not look like what you wanted anyway ;--(
Thanks for letting me know about this silly documentation bit though, I will fix it in the next release.
|