commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954106 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test: testScript.sh xslt/enumerateEvents.xsl
Date Sat, 12 Jun 2010 19:40:51 GMT
Author: jbeard
Date: Sat Jun 12 19:40:51 2010
New Revision: 954106

URL: http://svn.apache.org/viewvc?rev=954106&view=rev
Log:
Added transformation to get unique events.

Added:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl   (with props)
Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/testScript.sh

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=954106&r1=954105&r2=954106&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:40:51 2010
@@ -10,5 +10,7 @@ xsltproc xslt/appendTransitionInformatio
 xsltproc xslt/nameTransitions.xsl - | \
 xsltproc xslt/flattenTransitions.xsl - | \
 xsltproc xslt/numberStatesAndTransitions.xsl - | \
+#todo: this next one can happen earlier, and for state pattern as well.
+xsltproc xslt/enumerateEvents.xsl - | \
 xmlindent > tmp_IR.xml;
 #xsltproc xslt/StatePatternStatechartGenerator.xsl tmp_IR.xml

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl?rev=954106&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl Sat Jun 12 19:40:51
2010
@@ -0,0 +1,43 @@
+<?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"/>
+
+	<xsl:key name="events" match="s:transition" use="@event"/>	<!-- used for generating
unique list -->
+
+	<!-- we copy them, so that we can use their positions as identifiers -->
+
+	<!-- identity transform -->
+	<xsl:template match="@*|node()">
+		<xsl:copy>
+			<xsl:apply-templates select="@*|node()"/>
+		</xsl:copy>
+	</xsl:template>
+
+	<xsl:template match="/s:scxml">
+		<xsl:variable name="uniqueEvents" select="//s:transition[generate-id(.)=generate-id(key('events',@event)[1])]/@event"/>
+
+		<xsl:copy>
+			<xsl:apply-templates match="@*|node()"/>
+	
+			<c:eventsEnum>
+				<xsl:for-each select="$uniqueEvents">
+					<c:event>
+						<c:name>
+							<xsl:value-of select="."/>
+						</c:name>
+						<c:id>
+							<xsl:value-of select="position()"/>
+						</c:id>
+					</c:event>
+				</xsl:for-each>	
+			</c:eventsEnum>
+		</xsl:copy>
+	</xsl:template>
+
+
+</xsl:stylesheet>
+

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/enumerateEvents.xsl
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message