You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jb...@apache.org on 2010/06/12 21:37:24 UTC
svn commit: r954078 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test:
testScript.sh
xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
Author: jbeard
Date: Sat Jun 12 19:37:24 2010
New Revision: 954078
URL: http://svn.apache.org/viewvc?rev=954078&view=rev
Log:
Added another transformation, did some testing. Looks good.
Added:
commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh (with props)
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl (with props)
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh?rev=954078&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh Sat Jun 12 19:37:24 2010
@@ -0,0 +1 @@
+xsltproc xslt/normalizeInitialStates.xsl kitchen_sink/KitchenSink.xml | xsltproc xslt/generateUniqueStateIds.xsl - | xsltproc xslt/splitTransitionTargets.xsl - | xsltproc xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl - | xmlindent
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
------------------------------------------------------------------------------
svn:executable = *
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl?rev=954078&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl Sat Jun 12 19:37:24 2010
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:s="http://www.w3.org/2005/07/scxml"
+ xmlns="http://www.w3.org/2005/07/scxml"
+ xmlns:c="http://msdl.cs.mcgill.ca/"
+ version="1.0">
+ <xsl:output method="xml"/>
+
+ <!-- identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!--
+ //change transitions that point to non-basic states to point instead to the initial states
+ //note that we only change the transitions stored in our custom-namespaced elements, so this
+ //is still legal SCXML
+ util.foreach(conf.transitions,function(t){
+ util.foreach(t.msdl::targets.msdl::target,function(targetNode){
+ var target = conf.allStates.(@id == targetNode.msdl::targetState.text());
+
+ //if he is a composite, update the transition to point to his initial state
+ if(conf.compositeStates.contains(target)){
+ targetNode.msdl::targetState.setChildren(target.initial.@id.toString());
+ }
+ });
+ });
+ -->
+
+ <xsl:template match="c:targetState">
+ <!-- get the target state node-->
+ <xsl:variable name="targetId">
+ <xsl:value-of select="text()"/>
+ </xsl:variable>
+
+ <xsl:variable name="targetState" select="//*[(self::s:state or self::s:parallel) and @id = $targetId]"/>
+
+ <xsl:copy>
+ <xsl:choose>
+ <xsl:when test="$targetState
+ and $targetState//*[(self::s:state or self::s:parallel or self::s:final or self::s:initial or self::s:scxml or self::s:history)]">
+ <xsl:value-of select="$targetState/s:initial/@id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="text()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:copy>
+
+ </xsl:template>
+
+</xsl:stylesheet>
+
+
+
+
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl
------------------------------------------------------------------------------
svn:eol-style = native