ovidiu 02/03/23 23:42:58
Modified: src/scratchpad/schecoon/src/org/apache/cocoon/markup/xsp
jpath.xsl
Log:
Added jpath:choose, jpath:when and jpath:otherwise.
Added <jpath:continuation select="level"/> to obtain the current
continuation id.
Revision Changes Path
1.6 +42 -0
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/markup/xsp/jpath.xsl
Index: jpath.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/markup/xsp/jpath.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- jpath.xsl 19 Mar 2002 09:43:16 -0000 1.5
+++ jpath.xsl 24 Mar 2002 07:42:58 -0000 1.6
@@ -19,6 +19,7 @@
<xsp:include>java.util.List</xsp:include>
<xsp:include>java.util.Iterator</xsp:include>
<xsp:include>org.apache.cocoon.environment.Environment</xsp:include>
+ <xsp:include>org.apache.cocoon.components.flow.WebContinuation</xsp:include>
<xsp:include>org.apache.commons.jpath.JPath</xsp:include>
<xsp:include>org.apache.commons.jpath.JPathContext</xsp:include>
</xsp:structure>
@@ -28,6 +29,8 @@
<xsp:init-page>
Object bean = ((Environment)resolver).getAttribute("bean-dict");
+ WebContinuation kont
+ = (WebContinuation)((Environment)resolver).getAttribute("kont");
JPathContext jpathContext = JPathContext.newContext(bean);
</xsp:init-page>
@@ -52,6 +55,33 @@
</xsl:choose>
</xsl:template>
+
+ <xsl:template match="jpath:choose">
+ <xsp:logic>
+ if (0) {
+ }
+ <xsl:apply-templates select="jpath:when|jpath:otherwise"/>
+ </xsp:logic>
+ </xsl:template>
+
+
+ <xsl:template match="jpath:when">
+ <xsp:logic>
+ else if (jpathContext.getValue("<xsl:value-of select="@test"/>") != null) {
+ <xsl:apply-templates/>
+ }
+ </xsp:logic>
+ </xsl:template>
+
+
+ <xsl:template match="jpath:otherwise">
+ <xsp:logic>
+ else {
+ <xsl:apply-templates/>
+ }
+ </xsp:logic>
+ </xsl:template>
+
<xsl:template match="jpath:for-each">
<xsl:variable name="old-context">
oldJPathContext<xsl:value-of select="count(ancestor-or-self::*)"/>
@@ -98,6 +128,18 @@
</xsl:message>
</xsl:otherwise>
</xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="jpath:continuation">
+ <xsl:variable name="level">
+ <xsl:choose>
+ <xsl:when test="@select">
+ <xsl:value-of select="@select"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ kont.getContinuation(<xsl:value-of select="$level"/>).getId()
</xsl:template>
<xsl:template match="@*|*|text()|processing-instruction()">
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]