diff --git a/xml/impl/resources/liveTemplates/zen_html.xml b/xml/impl/resources/liveTemplates/zen_html.xml
new file mode 100644
index 000000000000..97584af43ad1
--- /dev/null
+++ b/xml/impl/resources/liveTemplates/zen_html.xml
@@ -0,0 +1,1153 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xml/impl/resources/liveTemplates/zen_xsl.xml b/xml/impl/resources/liveTemplates/zen_xsl.xml
new file mode 100644
index 000000000000..de97235db242
--- /dev/null
+++ b/xml/impl/resources/liveTemplates/zen_xsl.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java b/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java
index ddd130748c77..7991581bfb17 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java
@@ -22,6 +22,6 @@ import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider;
*/
public class XmlDefaultLiveTemplatesProvider implements DefaultLiveTemplatesProvider {
public String[] getDefaultLiveTemplateFiles() {
- return new String[] { "/liveTemplates/html_xml" };
+ return new String[] { "/liveTemplates/html_xml", "/liveTemplates/zen_html", "/liveTemplates/zen_xsl" };
}
}
diff --git a/xml/impl/src/com/intellij/codeInsight/template/zencoding/XmlZenCodingTemplate.java b/xml/impl/src/com/intellij/codeInsight/template/zencoding/XmlZenCodingTemplate.java
index 0acceb6df469..c33e58464d2d 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/zencoding/XmlZenCodingTemplate.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/zencoding/XmlZenCodingTemplate.java
@@ -262,7 +262,7 @@ public class XmlZenCodingTemplate extends ZenCodingTemplate {
private static TemplateImpl generateTagTemplate(String tagName, CustomTemplateCallback callback) {
StringBuilder builder = new StringBuilder("<");
builder.append(tagName).append('>');
- if (isTrueXml(callback) || !HtmlUtil.isSingleHtmlTag(tagName)) {
+ if (!HtmlUtil.isSingleHtmlTag(tagName)) {
builder.append("$END$").append(tagName).append('>');
}
return new TemplateImpl("", builder.toString(), "");
diff --git a/xml/impl/src/com/intellij/codeInsight/template/zencoding/nodes/GenerationNode.java b/xml/impl/src/com/intellij/codeInsight/template/zencoding/nodes/GenerationNode.java
index 88dcb7b1622a..84430d374af5 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/zencoding/nodes/GenerationNode.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/zencoding/nodes/GenerationNode.java
@@ -206,7 +206,7 @@ public class GenerationNode {
return template;
}
- private static TemplateImpl invokeXmlTemplate(XmlTemplateToken token,
+ private static TemplateImpl invokeXmlTemplate(final XmlTemplateToken token,
CustomTemplateCallback callback,
final int numberInIteration,
@Nullable ZenCodingGenerator generator,
@@ -227,6 +227,7 @@ public class GenerationNode {
public void run() {
XmlTag tag1 = hasChildren ? expandEmptyTagIfNeccessary(tag) : tag;
setAttributeValues(tag1, attr2value, numberInIteration);
+ token.setFile((XmlFile)tag1.getContainingFile());
}
});
}
@@ -272,7 +273,6 @@ public class GenerationNode {
if (flag) {
builder.append(">").append(tag.getName()).append('>');
final XmlTag tag1 = XmlElementFactory.getInstance(tag.getProject()).createTagFromText(builder.toString(), XMLLanguage.INSTANCE);
- tag.replace(tag1);
return tag1;
}
return tag;