commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r1082570 - /commons/sandbox/gsoc/2010/scxml-js/trunk/src/xslt/util/scxml-to-dot.xsl
Date Thu, 17 Mar 2011 16:20:26 GMT
Author: jbeard
Date: Thu Mar 17 16:20:26 2011
New Revision: 1082570

URL: http://svn.apache.org/viewvc?rev=1082570&view=rev
Log:
Generate dots for default states.

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=1082570&r1=1082569&r2=1082570&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:26
2011
@@ -19,6 +19,7 @@
 This stylesheet takes as input an scxml document, and produces as output
 a document in the graphviz dot syntax.
 -->
+<!-- assume initial states have been normalized -->
 <stylesheet 
 	xmlns="http://www.w3.org/1999/XSL/Transform" 
 	xmlns:c="http://commons.apache.org/scxml-js"
@@ -30,8 +31,6 @@ a document in the graphviz dot syntax.
 
 	<param name="maxDepth" select="9999"/>
 
-	<variable name="states" select="//s:state | //s:parallel"/>
-
 	<template name="htmlTransitionLabel">
 		<param name="transitions"/>
 		<param name="heading"/>
@@ -63,14 +62,22 @@ a document in the graphviz dot syntax.
 	</template>
 
 	<template match="/">
+		<variable name="states" 
+			select="//s:state[count(ancestor::*) &lt;= $maxDepth] | 
+						//s:parallel[count(ancestor::*) &lt;= $maxDepth] | 
+						//s:initial[count(ancestor::*) &lt;= $maxDepth]"/>
+
 
 		digraph G {
+
+			compound=true; 
+
 			<apply-templates select="*[not(self::s:transition)]"/>
 
-			<for-each select="$states[count(ancestor::*) &lt; $maxDepth]">
+			<for-each select="$states">
 				<variable name="fromState" select="."/>
 
-				<for-each select="$states[count(ancestor::*) &lt; $maxDepth]">
+				<for-each select="$states">
 					<variable name="toState" select="."/>
 					
 					<variable name="transitions" select="$fromState/s:transition[@target=$toState/@id]"/>
@@ -95,9 +102,6 @@ a document in the graphviz dot syntax.
 						<when test="self::s:scxml">
 							color="blue";
 						</when>
-						<when test="../@initial = @id">
-							color="green";
-						</when>
 						<otherwise>
 							color="black";
 						</otherwise>
@@ -138,22 +142,19 @@ a document in the graphviz dot syntax.
 			</when>
 			<otherwise>
 				<value-of select="@id"/> 
-				<text>[shape=box, style="rounded"</text>
-					<if test="../@initial = @id">
-						<text>,color="green"</text>
-					</if>
-				<text>];</text>
+				<text>[shape=box, style="rounded"];</text>
 			</otherwise>
 		</choose>
 	</template>
 
 	<template match="s:state[not(.//s:state)]">
 		<value-of select="@id"/> 
-		<text>[shape=box, style="rounded,filled",fillcolor=gray</text>
-			<if test="../@initial = @id">
-				<text>,color="green"</text>
-			</if>
-		<text>];</text>
+		<text>[shape=box, style="rounded,filled",fillcolor=gray];</text>
+	</template>
+
+	<template match="s:initial">
+		<value-of select="@id"/> 
+		<text>[shape=point,width=.15];</text>
 	</template>
 
 	<template name="transition-template">



Mime
View raw message