DotML 是用于驱动 GraphViz 程序的点语言的另一种基于 XML 的语法。正常的使用方式是将DotML转换为dot,然后运行GraphViz生成SVG。我这样做的方式(来自 Ant)在这里:
<target name="dot-files" depends="merge-catalog" if="build.spec" unless="spec.exists">
<xslt in="${merged-spec.xml}" out="${dist.dir}/Overview.html" style="style/xslt-diff.xsl"
force="yes" classpathref="saxon9.classpath">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/initialMode" value="make-dot-files"/>
</factory>
<param name="baseline" expression="${baseline}"/>
<param name="show.diff.markup.string" expression="0"/>
</xslt>
</target>
<target name="diagrams" description="Process all the diagrams in the img directory"
depends="dot-files">
<foreach target="diagram" param="diagram">
<path>
<fileset dir="${dist.dir}/img">
<include name="*.dot"/>
</fileset>
</path>
</foreach>
</target>
<target name="diagram">
<echo message="Converting diagram ${diagram}"/>
<basename property="name" file="${diagram}" suffix=".dot"/>
<echo message=" to ${dist.dir}/img/${name}.svg"/>
<!-- Requires "dot" to be on the path. dot is part of GraphViz. Location might be GraphViz2.24/bin/dot-->
<exec executable="dot">
<arg line="-o${dist.dir}/img/${name}.raw.svg -Tsvg ${diagram} "/>
</exec>
<xslt in="${dist.dir}/img/${name}.raw.svg" out="${dist.dir}/img/${name}.svg" style="style/tidy-graphviz-svg.xsl"
force="yes" classpathref="saxon9.classpath"/>
</target>
我的情况有点不同,因为我从一个文档开始,该文档包含 XML 词汇表中的多个图表,首先需要将其转换为 DotML。