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:10 UTC
svn commit: r954076 - in /commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt:
generateUniqueStateIds.xsl normalizeInitialStates.xsl
Author: jbeard
Date: Sat Jun 12 19:37:10 2010
New Revision: 954076
URL: http://svn.apache.org/viewvc?rev=954076&view=rev
Log:
Added two new xsl transformations for the transforms described in SCXMLCompiler.
Added:
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl (with props)
commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl (with props)
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl?rev=954076&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl Sat Jun 12 19:37:10 2010
@@ -0,0 +1,32 @@
+<?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"
+ version="1.0">
+ <xsl:output method="xml"/>
+
+ <!-- identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="s:state | s:initial | s:parallel | s:final | s:scxml | s:history">
+ <xsl:variable name="newId" select="concat(local-name(),'_',generate-id() )" />
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+
+ <xsl:if test="not(@id)">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$newId"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/generateUniqueStateIds.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=954076&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl Sat Jun 12 19:37:10 2010
@@ -0,0 +1,27 @@
+<?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"
+ version="1.0">
+ <xsl:output method="xml"/>
+
+ <!-- identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="s:*[@initial]">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+
+ <initial>
+ <transition target="{@initial}"/>
+ </initial>
+ <xsl:apply-templates select="node()"/>
+
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>
+
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/normalizeInitialStates.xsl
------------------------------------------------------------------------------
svn:eol-style = native