@Override
    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
        if (!XsltSupport.isXsltFile(file)) return false;

        final int offset = editor.getCaretModel().getOffset();
        final PsiElement element = file.findElementAt(offset);
      final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
        if (tag == null) {
            return false;
        }
        if (!XsltSupport.isXsltTag(tag)) {
            return false;
        } else if (!"attribute".equals(tag.getLocalName())) {
            return false;
        } else if (tag.getAttribute("name") == null) {
            return false;
        } else if (findParent(tag) == null) {
            // we cannot "inline" anything that isn't clearly the child of either an xsl:element or a literal result element
            return false;
        }

        final ASTNode node = tag.getNode();
        if (node == null) return false;
        final ASTNode nameNode = XmlChildRole.START_TAG_NAME_FINDER.findChild(node);

        if (nameNode == null || !nameNode.getTextRange().contains(offset)) {
            return false;
        }

        final XmlTag[] texts = tag.findSubTags("text", XsltSupport.XSLT_NS);
        final XmlTag[] exprs = tag.findSubTags("value-of", XsltSupport.XSLT_NS);
        final PsiElement[] children = tag.getChildren();
        for (PsiElement child : children) {
            if (child instanceof XmlText text) {
              if (text.getText().trim().length() == 0) {
                    if (texts.length == 0 && exprs.length == 0) {
                        return false;
                    }
                }
            } else if (child instanceof XmlTag t) {
              if (XsltSupport.isXsltTag(t)) {
                    if ("text".equals(t.getLocalName())) {

                    } else if ("value-of".equals(t.getLocalName())) {
                        if (t.getAttribute("select") == null) {
                            return false;
                        }
                    } else {
                        return false;
                    }
                } else {
                    return false;
                }
            }
        }
        return true;
    }
@Override
    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)