Converting XML to DOT
There's an XML syntax for DOT called DotML at http://martin-loetzsch.de/DOTML/. Generating a generic DotML tree from XML is very straightforward using XSLT. Most of it is just:

&lt;xsl:template match="*"&gt;
  &lt;node id="{generate-id()}" label="{name()}"/&gt;
  &lt;edge from="{generate-id(..)}" to="{generate-id()}"/&gt;
  &lt;xsl:apply-templates/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="text()"&gt;
  &lt;node id="{generate-id()}" label="{.}"/&gt;
  &lt;edge from="{generate-id(..)}" to="{generate-id()}"/&gt;
&lt;/xsl:template&gt;