Author: jbeard
Date: Thu Mar 17 16:18:48 2011
New Revision: 1082563
URL: http://svn.apache.org/viewvc?rev=1082563&view=rev
Log:
Added better handling of static reactions.
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=1082563&r1=1082562&r2=1082563&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:18:48 2011
@@ -22,16 +22,16 @@ a document in the graphviz dot syntax.
<stylesheet
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:c="http://commons.apache.org/scxml-js"
- xmlns:exsl="http://exslt.org/common"
xmlns:s="http://www.w3.org/2005/07/scxml"
version="1.0">
+ <import href="xml-to-string.xsl"/>
<output method="text"/>
<template match="/">
digraph G {
<apply-templates select="*[not(self::s:transition)]"/>
- <apply-templates select="//s:transition"/>
+ <apply-templates select="//s:transition[@target]"/>
}
</template>
@@ -41,6 +41,12 @@ a document in the graphviz dot syntax.
label="<value-of select="@id"/>";
<apply-templates select="*[not(self::s:transition)]"/>
+
+ <variable name="static_reactions"
select="s:transition[not(@target)]"/>
+
+ <if test="$static_reactions">
+ <value-of select="@id"/>_static_reactions
[label=<<TABLE><for-each
select="$static_reactions"><TR><TD><value-of
select="@event"/></TD><TD><call-template
name="attribute-value"><with-param name="text"
select="@cond"/></call-template></TD></TR></for-each></TABLE>>];
+ </if>
}
</template>
@@ -48,7 +54,7 @@ a document in the graphviz dot syntax.
<value-of select="@id"/>;
</template>
- <template match="s:transition">
+ <template match="s:transition[@target]">
<variable name="sourceId" select="../@id"/>
<variable name="sourceState" select="//*[@id=$sourceId]"/>
<variable name="sourceStatesBasicSubstates"
select="$sourceState//s:state[not(.//s:state)]"/>
@@ -67,17 +73,7 @@ a document in the graphviz dot syntax.
</variable>
- <variable name="targetId">
- <choose>
- <when test="@target">
- <value-of select="@target"/>
- </when>
- <otherwise>
- <value-of select="$sourceId"/>
- </otherwise>
- </choose>
- </variable>
-
+ <variable name="targetId" select="@target"/>
<variable name="targetState" select="//*[@id=$targetId]"/>
<variable name="targetStatesBasicSubstates"
select="$targetState//s:state[not(.//s:state)]"/>
@@ -105,7 +101,7 @@ a document in the graphviz dot syntax.
lhead=cluster_<value-of select="$targetId"/>,
</if>
<if test="@event | s:script | @cond">
- label="<value-of select="@event"/>[<if
test="@cond"><value-of select="@cond"/></if>]"
+ label="<value-of select="@event"/><if
test="@cond">[<value-of select="@cond"/>]</if>"
</if>
];
</template>