Author: jbeard
Date: Thu Mar 17 16:19:25 2011
New Revision: 1082565
URL: http://svn.apache.org/viewvc?rev=1082565&view=rev
Log:
Moved out ugly code that generates transitions table.
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=1082565&r1=1082564&r2=1082565&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:19:25 2011
@@ -29,6 +29,25 @@ a document in the graphviz dot syntax.
<variable name="states" select="//s:state | //s:parallel"/>
+ <template name="htmlTransitionLabel">
+ <param name="transitions"/>
+
+ <text>label=<<TABLE></text>
+ <for-each select="$transitions">
+ <text><TR></text>
+ <text><TD></text>
+ <value-of select="@event"/>
+ <text></TD></text>
+ <text><TD></text>
+ <call-template name="attribute-value">
+ <with-param name="text" select="@cond"/>
+ </call-template>
+ <text></TD></text>
+ <text></TR></text>
+ </for-each>
+ <text></TABLE>></text>
+ </template>
+
<template match="/">
digraph G {
<apply-templates select="*[not(self::s:transition)]"/>
@@ -63,7 +82,13 @@ a document in the graphviz dot syntax.
<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>>];
+ <value-of select="@id"/>
+ <text>_static_reactions </text>
+ <text>[ </text>
+ <call-template name="htmlTransitionLabel">
+ <with-param name="transitions"
select="$static_reactions"/>
+ </call-template>
+ <text> ];</text>
</if>
}
</template>
@@ -123,8 +148,9 @@ a document in the graphviz dot syntax.
<choose>
<when test="count($transitions) > 1">
<!-- multiple transitions. use html
label -->
- <!-- FIXME: this code is ugly and
repeated twice -->
- label=<<TABLE><for-each
select="$transitions"><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>>
+ <call-template
name="htmlTransitionLabel">
+ <with-param name="transitions"
select="$transitions"/>
+ </call-template>
</when>
<otherwise>
<variable name="firstTransition"
select="$transitions[1]"/>