void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { XmlTag myTag = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), XmlTag.class); final XmlTag tag = XsltCodeInsightUtil.getTemplateTag(myTag, false); if (tag == null) { return; } final XmlTag parentTag = tag.getParentTag(); assert parentTag != null; XmlTag templateTag = parentTag.createChildTag("template", XsltSupport.XSLT_NS, DUMMY_TAG, false); templateTag.setAttribute("name", myName); final XmlTag[] arguments = myTag.findSubTags("with-param", XsltSupport.XSLT_NS); if (arguments.length > 0) { final XmlTag dummy = templateTag.findFirstSubTag("dummy"); for (XmlTag arg : arguments) { final String argName = arg.getAttributeValue("name"); if (argName != null) { final XmlTag paramTag = parentTag.createChildTag("param", XsltSupport.XSLT_NS, null, false); paramTag.setAttribute("name", argName); templateTag.addBefore(paramTag, dummy); } } } // TODO ensure we have line breaks before the new <xsl:template> and between its opening and closing tags VirtualFile file = myTag.getContainingFile().getVirtualFile(); if (file == null) return; XmlTag newTemplateTag = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(templateTag); Navigatable openFileDescriptor = PsiNavigationSupport.getInstance().createNavigatable(project, file, newTemplateTag.getTextRange().getStartOffset()); openFileDescriptor.navigate(true); }