Author: jbeard
Date: Thu Mar 17 16:20:44 2011
New Revision: 1082571

URL: http://svn.apache.org/viewvc?rev=1082571&view=rev
Log:
Added ability to accept parameters to make chart less verbose.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl

Modified: 
commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl?rev=1082571&r1=1082570&r2=1082571&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl 
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl Thu 
Mar 17 16:20:44 2011
@@ -30,15 +30,31 @@ a document in the graphviz dot syntax.
        <output method="text"/>
 
        <param name="maxDepth" select="9999"/>
+       <param name="printScript" select="false()"/>
+       <param name="printCondition" select="false()"/>
 
        <template name="htmlTransitionLabel">
                <param name="transitions"/>
                <param name="heading"/>
 
+               <variable name="colspan">
+                       <choose>
+                               <when test="$printScript and $printCondition">
+                                       <text>3</text>
+                               </when>
+                               <when test="$printScript or $printCondition">
+                                       <text>2</text>
+                               </when>
+                               <otherwise>
+                                       <text>1</text>
+                               </otherwise>
+                       </choose>
+               </variable>
+
                <text>label=&lt;&lt;TABLE&gt;</text>
                <if test="$heading">
                        <text>&lt;TR&gt;</text>
-                               <text>&lt;TD colspan="3"&gt;</text>
+                               <text>&lt;TD colspan="</text><value-of 
select="$colspan"/><text>"&gt;</text>
                                <value-of select="$heading"/>
                                <text>&lt;/TD&gt;</text>
                        <text>&lt;/TR&gt;</text>
@@ -48,14 +64,18 @@ a document in the graphviz dot syntax.
                                <text>&lt;TD&gt;</text>
                                <value-of select="@event"/>
                                <text>&lt;/TD&gt;</text>
-                               <text>&lt;TD&gt;</text>
-                               <call-template name="attribute-value">
-                                       <with-param name="text" select="@cond"/>
-                               </call-template>
-                               <text>&lt;/TD&gt;</text>
-                               <text>&lt;TD&gt;</text>
-                               <value-of select="s:script/text()"/>
-                               <text>&lt;/TD&gt;</text>
+                               <if test="$printCondition">
+                                       <text>&lt;TD&gt;</text>
+                                       <call-template name="attribute-value">
+                                               <with-param name="text" 
select="@cond"/>
+                                       </call-template>
+                                       <text>&lt;/TD&gt;</text>
+                               </if>
+                               <if test="$printScript">
+                                       <text>&lt;TD&gt;</text>
+                                       <value-of select="s:script/text()"/>
+                                       <text>&lt;/TD&gt;</text>
+                               </if>
                        <text>&lt;/TR&gt;</text>
                </for-each>
                <text>&lt;/TABLE&gt;&gt;</text>
@@ -218,12 +238,12 @@ a document in the graphviz dot syntax.
                                        <if test="$firstTransition/@event | 
$firstTransition/s:script | $firstTransition/@cond">
                                                <text>label="</text> 
                                                <value-of 
select="$firstTransition/@event"/> 
-                                               <if 
test="$firstTransition/@cond"> 
+                                               <if test="$printCondition and 
$firstTransition/@cond"> 
                                                        <text>[</text>
                                                        <value-of 
select="$firstTransition/@cond"/>
                                                        <text>]</text> 
                                                </if> 
-                                               <if 
test="$firstTransition/s:script"> 
+                                               <if test="$printScript and 
$firstTransition/s:script"> 
                                                        <text>/</text>
                                                        <call-template 
name="replace-string"> 
                                                                <with-param 
name="text" select="$firstTransition/s:script"/> 


Reply via email to