commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954082 - /commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl
Date Sat, 12 Jun 2010 19:37:51 GMT
Author: jbeard
Date: Sat Jun 12 19:37:50 2010
New Revision: 954082

URL: http://svn.apache.org/viewvc?rev=954082&view=rev
Log:
Intermediate commit.

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

Added: 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=954082&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/xslt/transformIf.xsl Sat Jun 12 19:37:50
2010
@@ -0,0 +1,56 @@
+<?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>
+
+	<xsl:template match="s:if">
+		<xsl:variable name="elseOrElseIfNodes" select="s:elseif | s:else"/>
+		<xsl:variable name="firstElseOrElseIfNodes" select="(s:elseif | s:else)[1]"/>
+		<xsl:variable name="nodePosition">
+			<xsl:choose>
+				<xsl:when test="$elseOrElseIfNodes">
+					<xsl:value-of select="position($firstElseOrElseIfNodes)"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:value-of select="count(*)"/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="test" select="subsequence(1,$nodePosition)"/>
+		<xsl:message>
+			<xsl:value-of select="'----------'"/>
+			<xsl:copy-of select="$test"/>
+			<xsl:value-of select="'----------'"/>
+		</xsl:message>
+
+		<xsl:copy>
+			<xsl:apply-templates select="@*"/>
+			<!--
+			<c:executableContent>
+				<xsl:apply-templates select="subsequence(1,$nodePosition)"/>
+			</c:executableContent>
+			<xsl:apply-templates select="subsequence($nodePosition + 1,count(*))"/>
+			-->
+		</xsl:copy>
+	</xsl:template>
+
+	<xsl:template match="s:elseif | s:else">
+	   <xsl:copy>
+		<c:executableContent>
+		      <xsl:apply-templates select="@*|node()"/>
+		</c:executableContent>
+	   </xsl:copy>
+	</xsl:template>
+
+</xsl:stylesheet>

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



Mime
View raw message