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/27 05:47:56 UTC
svn commit: r958322 -
/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl
Author: jbeard
Date: Sun Jun 27 03:47:55 2010
New Revision: 958322
URL: http://svn.apache.org/viewvc?rev=958322&view=rev
Log:
Intermediate commit. Not sure if this code works yet.
Added:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl (with props)
Added: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl?rev=958322&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl Sun Jun 27 03:47:55 2010
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<!--
+This stylesheet adds attributes isBasic="true" to basic states, and
+isHistory="true" to history states.
+-->
+<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://commons.apache.org/scxml-js"
+ version="1.0">
+ <xsl:output method="xml"/>
+
+ <!-- identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- recursive template -->
+ <xsl:template name="genEventComponents">
+ <xsl:param name="originalEventString" />
+ <xsl:param name="remainingEventString" />
+ <xsl:variable name="first" select="substring-before($remainingEventString, '.')" />
+
+ <xsl:choose>
+ <!-- base case -->
+ <xsl:when test="not($first)">
+ <c:eventComponent name="{remainingEventString}" terminalId="{originalEventString}"/>
+ </xsl:when>
+ <!-- recursive step -->
+ <xsl:otherwise>
+
+ <xsl:variable name="remaining" select="substring-after($remainingEventString, '.')" />
+
+ <c:eventComponent name="{first}">
+ <xsl:call-template name="genEventComponents">
+ <xsl:with-param name="remainingEventString" select="$remainingEventString"/>
+ <xsl:with-param name="originalEventString" select="$originalEventString"/>
+ </xsl:call-template>
+ </c:eventComponent>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="/s:scxml">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+
+ <c:eventComponents>
+ <xsl:for-each select=".//@event">
+ <xsl:call-template name="genEventComponents">
+ <xsl:with-param name="remainingEventString" select="."/>
+ <xsl:with-param name="originalEventString" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </c:eventComponents>
+
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
+
Propchange: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-142/src/xslt/ir-compiler/constructEventComponentTreeFirstPass.xsl
------------------------------------------------------------------------------
svn:eol-style = native