code: boolean ancestorIsOk(ElemTemplateElement child)
    {
      while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction))
      {
        ElemTemplateElement parent = child.getParentElem();
        if (parent instanceof ElemExsltFuncResult 
            || parent instanceof ElemVariable
            || parent instanceof ElemParam
            || parent instanceof ElemMessage)
          return true;
        child = parent;      
      }
      return false;
    }
docs: Verify that a literal result belongs to a result element, a variable,
  or a parameter.