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:17 UTC

svn commit: r954077 - /commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl

Author: jbeard
Date: Sat Jun 12 19:37:16 2010
New Revision: 954077

URL: http://svn.apache.org/viewvc?rev=954077&view=rev
Log:
Added another xsl template to replace functionality in library.

Added:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl   (with props)

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl?rev=954077&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/splitTransitionTargets.xsl Sat Jun 12 19:37:16 2010
@@ -0,0 +1,59 @@
+<?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>
+
+	<!--
+	var targetIds = t.@target.toString().split(" ");
+
+	targetIds.forEach(function(targetId){
+		t.msdl::targets.msdl::target += <target xmlns={msdlNs}><targetState>{targetId}</targetState></target>;
+	});
+	-->
+
+	<!-- recursive template -->
+	<xsl:template name="transitionAttributeToNodeList">
+	    <xsl:param name="list" /> 
+	    <xsl:variable name="newlist" select="concat(normalize-space($list), ' ')" /> 
+	    <xsl:variable name="first" select="substring-before($newlist, ' ')" /> 
+	    <xsl:variable name="remaining" select="substring-after($newlist, ' ')" /> 
+
+	    <c:target>
+		<c:targetState>
+			<xsl:value-of select="$first" /> 
+		</c:targetState>
+	    </c:target>
+
+	    <xsl:if test="$remaining">
+		<xsl:call-template name="transitionAttributeToNodeList">
+			<xsl:with-param name="list" select="$remaining" /> 
+		</xsl:call-template>
+	    </xsl:if>
+	</xsl:template>
+
+	
+	<xsl:template match="s:transition">
+		<xsl:copy>
+			<xsl:apply-templates select="@*|node()"/>
+			<c:targets>
+				<xsl:call-template name="transitionAttributeToNodeList">
+					<xsl:with-param name="list" select="@target"/>
+				</xsl:call-template>	
+			</c:targets>
+		</xsl:copy>
+	</xsl:template>
+
+</xsl:stylesheet>
+
+
+

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