cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sonney <ke...@webslingerz.com>
Subject [1.8-dev patch] Global Vars in XSP - xsp:variable
Date Thu, 21 Sep 2000 16:22:57 GMT
ESQL has given me a new outlook on life. However, the inability to pass
<xsp:expr></xsp:expr> statements to esql has been a bit trying on one
application I'm writing. So, in a blinding flash of "wouldn't this would 
work if I had a global var, now wouldn't it?", I added the ability to
specify global variables in XSP, something that had been lacking. 

With this patch, you can do the following :

<xsp:sturcture>
	<xsp:variable>UserRecord user</xsp:variable>
	<xsp:variable>boolean debug = true</xsp:variable>
</xsp:structure>

FWIW, I *KNOW* we can do this with <xsp:logic> tags imediately after the
last <xsp:structure> tag, but using <xsp:variable>, IMHO seperates logic
from structure just that little bit further. It's also a bit clearer to
document. Especailly since the xsp docs don't talk about global vars, from
what I could see.  

Anyway, Here's the patch :

-- Cut Here - Begin 'cvs diff -u' --
Index: xsp-java.xsl
===================================================================
RCS
file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl,v
retrieving revision 1.20
diff -u -r1.20 xsp-java.xsl
--- xsp-java.xsl        2000/09/16 19:06:48     1.20
+++ xsp-java.xsl        2000/09/21 16:21:51
@@ -91,6 +91,11 @@
 
     public class <xsl:value-of select="@name"/> extends XSPPage {
       /* User Class Declarations */
+
+      <xsl:for-each select="xsp:structure/xsp:variable">
+       <xsl:value-of select="."/>;
+      </xsl:for-each>
+
       <xsl:apply-templates select="xsp:logic" />
 
       public void populateDocument(

-- Cut Here - End 'cvs diff -u' --

-- 
+-------------------------------------------+
| Kevin Sonney        kevin@webslingerZ.com |
| Systems Programmer    www.webslingerZ.com |
+-------------------------------------------+


Mime
View raw message