问题 I want to prettify some XML, and I found following code (in this answer, JSFiddle). I modified it like this: const xsltDoc = new DOMParser().parseFromString([ // describes how we want to modify the XML - indent everything '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">', ' <xsl:output omit-xml-declaration="yes" indent="yes"/>', ' <xsl:template match="node()|@*">', ' <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>', ' </xsl:template>', '</xsl:stylesheet>', ]