LOCAL XML AS MSXML2.DOMDocument60 LOCAL XSLT AS MSXML2.DOMDocument60 LOCAL XMLPrettifier AS String LOCAL Prettified AS String m.XML = CREATEOBJECT("MSXML2.DOMDocument.6.0") m.XSLT = CREATEOBJECT("MSXML2.DOMDocument.6.0") m.XML.LoadXML("<root><child><grandchild>Vera</grandchild><grandchild>Chuck</grandchild><grandchild>Dave</grandchild></child></root>") TEXT TO m.XMLPrettifier NOSHOW FLAGS 1 <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output encoding="utf-8" method="text" indent="no"/> <xsl:variable name="spaces" select="' '" /> <xsl:variable name="NL" select="' '" /> <xsl:template match="/"> <xsl:apply-templates select="node()"> <xsl:with-param name="indent" select="''"/> </xsl:apply-templates> </xsl:template> <xsl:template match="node()"> <xsl:param name="indent"/> <xsl:value-of select="$indent"/> <xsl:text><</xsl:text><xsl:value-of select="name(.)"/><xsl:apply-templates select="@*"/> <xsl:if test="not(node())"><xsl:text> /</xsl:text></xsl:if> <xsl:text>></xsl:text> <xsl:if test="node()"> <xsl:if test="node()[node()]"> <xsl:value-of select="$NL" /> </xsl:if> <xsl:apply-templates> <xsl:with-param name="indent" select="concat($indent, $spaces)"/> </xsl:apply-templates> <xsl:if test="node()[node()]"> <xsl:value-of select="$indent"/> </xsl:if> <xsl:text></</xsl:text><xsl:value-of select="name(.)"/><xsl:text>></xsl:text> </xsl:if> <xsl:value-of select="$NL" /> </xsl:template> <xsl:template match="@*"> <xsl:text> </xsl:text> <xsl:value-of select="name(.)"/> <xsl:text>=</xsl:text> <xsl:value-of select="concat('"', ., '"')"/> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="normalize-space(.)"/> </xsl:template> <xsl:template match="comment()"> <xsl:text><--</xsl:text><xsl:value-of select="."/><xsl:text>--></xsl:text> </xsl:template> <xsl:template match="processing-instruction()"> <xsl:text><?</xsl:text><xsl:value-of select="name(.)"/><xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text>?></xsl:text> <xsl:value-of select="$NL" /> </xsl:template> </xsl:stylesheet> ENDTEXT m.XSLT.LoadXML(m.XMLPrettifier) m.Prettified = m.XML.Transformnode(m.XSLT) ? m.PrettifiedCredits: transformation stylesheet from https://gist.github.com/Jalalhejazi/5550511, with small changes.