hi,

attached you find a xsl script, which generates a .dot out of a
build.xml file. The dot file can be rendered using the dot command (from
the graphviz package, see http://www.graphviz.org/) to lots of formats
like ps or png.
Minimal instructions are in the xsl file.

Stefan
-- 

 < W E B M A C H E R > 
EDV+INTERNETSERVICE GMBH

POST: August Bebel Str. 69
      04275 Leipzig

FON:  +49 341 30 34 833
FAX:  +49 341 30 34 840
WEB:  www.webmacher.de
<?xml version="1.0"?>
<!-- ant2dot.xsl 0.1 (C) by Stefan Kost <[EMAIL PROTECTED]> (05.July.2002) -->
<!--
to compile do
  setenv LANG=POSIX   (needed for CVS version of xalan/xerces)
  java -cp ~/lib/xalan.jar:~/lib/xerces.jar org.apache.xalan.xslt.Process -XSL 
ant2dot.xsl -IN build.xml -OUT build.dot
  dot -Tps build.dot -obuild.ps
  dot -Tpng build.dot -obuild.png
-->
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

        <xsl:output method="text"/>

        <xsl:template match="/project">
digraph project {
        node [shape=box,fontname="Arial",fontsize="10"];
        edge [fontname="Arial",fontsize="8"];
        rankdir=LR;
        <xsl:apply-templates/>
}
        </xsl:template>

        <xsl:template match="/project/target">
                <xsl:value-of select="@name"/> [label="<xsl:value-of 
select="@name"/>\n<xsl:value-of select="@description"/>"];
                <xsl:variable name="target" select="@name"/>
                <xsl:variable name="depends" select="@depends"/>
                <xsl:if test="$depends!=''">
                        <xsl:call-template name="split-depends">
                                <xsl:with-param name="depends" select="$depends"/>
                                <xsl:with-param name="target" select="$target"/>
                        </xsl:call-template>
                </xsl:if>
        </xsl:template>
        
        <xsl:template name="split-depends">
                <xsl:param name="depends"/>
                <xsl:param name="target"/>
                <xsl:choose>
                        <xsl:when test="contains($depends,',')">
                                <xsl:variable name="dependsCur" 
select="normalize-space(substring-before($depends, ','))"/>
                                <xsl:variable name="dependsNext" 
select="normalize-space(substring-after($depends, ','))"/>
                                <xsl:value-of select="$dependsCur"/> -&gt; 
<xsl:value-of select="$target"/>;
                                <xsl:call-template name="split-depends">
                                        <xsl:with-param name="depends" 
select="$dependsNext"/>
                                        <xsl:with-param name="target" 
select="$target"/>
                                </xsl:call-template>
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:value-of select="$depends"/> -&gt; <xsl:value-of 
select="$target"/>;
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        
</xsl:transform>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to