private void checkDeclaration(final XsltNamedElement element, final String name, ProblemsHolder holder) {
                final XmlTag tag = element.getTag();

                final PsiElement token = element.getNameIdentifier();
                if (name == null || name.length() == 0) {
                    if (token != null) {
                        holder.registerProblem(token, XPathBundle.message("inspection.message.empty.name.not.permitted"));
                    } else {
                        final XmlAttribute attribute = element.getNameAttribute();
                        if (attribute != null) {
                            final XmlAttributeValue e = attribute.getValueElement();
                            if (e != null) {
                                holder.registerProblem(e, XPathBundle.message("inspection.message.empty.name.not.permitted"));
                            }
                        }
                    }
                } else if (!isLegalName(name, holder.getManager().getProject())) {
                    assert token != null;
                    holder.registerProblem(token, XPathBundle.message("inspection.message.illegal.name"));
                } else {
                    assert token != null;
                    final XmlFile file = (XmlFile)tag.getContainingFile();
                    final XmlTag duplicatedSymbol = DeclarationChecker.getInstance(file).getDuplicatedSymbol(tag);
                    if (duplicatedSymbol != null) {
                      if (duplicatedSymbol.getContainingFile() == file) {
                        holder.registerProblem(token, XPathBundle.message("inspection.message.duplicate.declaration"));
                      } else {
                        holder.registerProblem(token, XPathBundle.message("inspection.message.duplicates.declaration.from", duplicatedSymbol.getContainingFile().getName()));
                      }
                    }
                }
            }
private void checkDeclaration(final XsltNamedElement element, final String name, ProblemsHolder holder)