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:38:22 UTC
svn commit: r954086 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test:
testScript.sh xslt/appendBasicStateInformation.xsl
xslt/appendTransitionInformation.xsl xslt/normalizeInitialStates.xsl
xslt/transformIf.xsl
Author: jbeard
Date: Sat Jun 12 19:38:22 2010
New Revision: 954086
URL: http://svn.apache.org/viewvc?rev=954086&view=rev
Log:
appendTransitionInformation.xsl appears to be working. Minor tweaks on other transformations.
Modified:
commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendBasicStateInformation.xsl
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendTransitionInformation.xsl
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl
Modified: 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=954086&r1=954085&r2=954086&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh Sat Jun 12 19:38:22 2010
@@ -1 +1,10 @@
-xsltproc xslt/normalizeInitialStates.xsl kitchen_sink/KitchenSink.xml | xsltproc xslt/generateUniqueStateIds.xsl - | xsltproc xslt/splitTransitionTargets.xsl - | xsltproc xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl - | xsltproc xslt/computeLCA.xsl - | xmlindent
+xsltproc xslt/normalizeInitialStates.xsl kitchen_sink/KitchenSink_executableContent.xml | \
+xsltproc xslt/generateUniqueStateIds.xsl - | \
+xsltproc xslt/splitTransitionTargets.xsl - | \
+xsltproc xslt/changeTransitionsPointingToCompoundStatesToPointToInitialStates.xsl - | \
+xsltproc xslt/computeLCA.xsl - | \
+xsltproc xslt/transformIf.xsl - | \
+xsltproc xslt/appendStateInformation.xsl - | \
+xsltproc xslt/appendBasicStateInformation.xsl - | \
+xsltproc xslt/appendTransitionInformation.xsl - | \
+xmlindent
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendBasicStateInformation.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendBasicStateInformation.xsl?rev=954086&r1=954085&r2=954086&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendBasicStateInformation.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendBasicStateInformation.xsl Sat Jun 12 19:38:22 2010
@@ -27,7 +27,3 @@
</xsl:template>
</xsl:stylesheet>
-
-
-
-
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendTransitionInformation.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendTransitionInformation.xsl?rev=954086&r1=954085&r2=954086&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendTransitionInformation.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/appendTransitionInformation.xsl Sat Jun 12 19:38:22 2010
@@ -44,35 +44,30 @@
<xsl:variable name="parallels" select="//s:parallel"/>
- <xsl:variable name="parallelRegions">
- <xsl:value-of select="//s:parallel/s:state"/>
- </xsl:variable>
+ <xsl:variable name="parallelRegions" select="$parallels/s:state"/>
<xsl:template match="s:transition">
<xsl:variable name="sourceState" select="parent::*"/>
<xsl:variable name="targetId" select="c:targets/c:target/c:targetState[1]"/>
- <xsl:variable name="targetState" select="//*[(self::s:state or self::s:parallel or self::s:final or self::s:initial or self::s:scxml or self::s:history) and @id = $targetId]"/>
+ <xsl:variable name="targetState"
+ select="//*[(self::s:state or self::s:parallel or self::s:final or self::s:initial or self::s:scxml or self::s:history) and @id = $targetId]"/>
<xsl:copy>
<xsl:apply-templates select="@*"/>
-
- <xsl:message>
- <xsl:text>START </xsl:text>
- <xsl:text>Parallels:</xsl:text> <xsl:value-of select="$parallels/@id"/> <xsl:text> </xsl:text>
- <xsl:text>Parallel Regions:</xsl:text> <xsl:value-of select="count($parallelRegions)"/> <xsl:text> </xsl:text>
- <xsl:text>Source state:</xsl:text> <xsl:value-of select="$sourceState/@id"/> <xsl:text> </xsl:text>
- <xsl:text>Target state:</xsl:text> <xsl:value-of select="$targetState/@id"/> <xsl:text> </xsl:text>
- <xsl:text>END </xsl:text>
- </xsl:message>
<!-- get his parallel region -->
- <xsl:variable name="sourceParallelRegion" select="$parallelRegions/self::*[.//*[. = $sourceState]]"/>
- <xsl:variable name="targetParallelRegion" select="$parallelRegions/self::*[.//*[. = $targetState]]"/>
+ <!--
+ <xsl:variable name="sourceParallelRegion" select="$parallelRegions[.//*[. = $sourceState]]"/>
+ <xsl:variable name="targetParallelRegion" select="$parallelRegions[.//*[. = $targetState]]"/>
+ -->
+ <xsl:variable name="sourceParallelRegion" select="$sourceState/ancestor::s:state[parent::s:parallel][1]"/>
+ <xsl:variable name="targetParallelRegion" select="$targetState/ancestor::s:state[parent::s:parallel][1]"/>
<!-- if source parallel region and end parallel region are not the same,
then we say he exits exitsParallelRegion -->
- <xsl:if test="not($sourceParallelRegion = $targetParallelRegion)">
+ <xsl:if test="$sourceParallelRegion
+ and not($sourceParallelRegion = $targetParallelRegion)">
<xsl:attribute name="exitsParallelRegion" namespace="http://msdl.cs.mcgill.ca/">
<xsl:value-of select="'true'"/>
</xsl:attribute>
@@ -81,27 +76,62 @@
<!-- if the source is a parallel state or one of his descendants,
and the target is outside of the parallel state that most closely wraps the source state,
then we we say he is preempted -->
- <xsl:variable name="sourceParallel" select="$parallels[self::* = $sourceState or .//*[. = $sourceState]]"/>
- <xsl:variable name="targetParallel" select="$parallels[self::* = $targetState or .//*[. = $targetState]]"/>
+ <!--
+ <xsl:variable name="sourceParallel" select="$parallels[descendant-or-self::*[. = $sourceState]]"/>
+ <xsl:variable name="targetParallel" select="$parallels[descendant-or-self::*[. = $targetState]]"/>
+ -->
+ <xsl:variable name="sourceParallel" select="$sourceState/ancestor-or-self::s:parallel[1]"/>
+ <xsl:variable name="targetParallel" select="$targetState/ancestor-or-self::s:parallel[1]"/>
- <xsl:if test="not($sourceParallel = $targetParallel)">
+ <xsl:if test="$sourceParallel and not($sourceParallel = $targetParallel)">
<xsl:attribute name="isPreempted" namespace="http://msdl.cs.mcgill.ca/">
<xsl:value-of select="'true'"/>
</xsl:attribute>
</xsl:if>
-
-
- <!--FIXME: we actually need to test if it's the SAME parallel substate -->
- <!--FIXME: change isParallelSubstate to isDescendantOfParallelRegion -->
- <!-- FIXME: isParallelStateOrDescendantOfParallelState ... but, again we need to know... -->
+
<!--
- <xsl:if test="$sourceState/@c:isParallelSubstate and
- not($targetState/@c:isParallelSubstate)">
- </xsl:if>
+ <xsl:message>
+ <xsl:text>START </xsl:text>
+ <xsl:text>Source State: </xsl:text>
+ <xsl:value-of select="$sourceState/@id"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>Source Encapsulating Parallel Region (if any): </xsl:text>
+ <xsl:value-of select="$sourceParallelRegion/@id"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>Source Encapsulating Parallel or Self (if any): </xsl:text>
+ <xsl:value-of select="$sourceParallel/@id"/>
+ <xsl:text> </xsl:text>
+
+ <xsl:text> </xsl:text>
+
+ <xsl:text>Target State: </xsl:text>
+ <xsl:value-of select="$targetState/@id"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>Target Encapsulating Parallel Region (if any): </xsl:text>
+ <xsl:value-of select="$targetParallelRegion/@id"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>Target Encapsulating Parallel or Self (if any): </xsl:text>
+ <xsl:value-of select="$targetParallel/@id"/>
+ <xsl:text> </xsl:text>
+
+ <xsl:text> </xsl:text>
+
+ <xsl:text>Exits parallel region: </xsl:text>
+ <xsl:value-of select="$sourceParallelRegion
+ and not($sourceParallelRegion = $targetParallelRegion)"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>Exits parallel: </xsl:text>
+ <xsl:value-of select="$sourceParallel
+ and not($sourceParallel = $targetParallel)"/>
+ <xsl:text> </xsl:text>
+
+ <xsl:text>END </xsl:text>
+ </xsl:message>
-->
<xsl:apply-templates select="node()"/>
</xsl:copy>
+
</xsl:template>
</xsl:stylesheet>
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl?rev=954086&r1=954085&r2=954086&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl Sat Jun 12 19:38:22 2010
@@ -16,7 +16,7 @@
<xsl:copy>
<xsl:apply-templates select="@*"/>
- <initial>
+ <initial id="{concat(local-name(),'_',@id,'_initial')}">
<transition target="{@initial}"/>
</initial>
<xsl:apply-templates select="node()"/>
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl?rev=954086&r1=954085&r2=954086&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl Sat Jun 12 19:38:22 2010
@@ -18,11 +18,13 @@
<xsl:template name="consume">
<xsl:param name="currentNode"/>
+ <!--
<xsl:message>
- <xsl:text>---start---</xsl:text>
+ <xsl:text>start</xsl:text>
<xsl:copy-of select="local-name($currentNode)"/>
- <xsl:text>---end---</xsl:text>
+ <xsl:text>end</xsl:text>
</xsl:message>
+ -->
<xsl:if test="$currentNode and
not($currentNode/self::else or $currentNode/self::elseif)">