cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Fagnani-Bell <jus...@paraliansoftware.com>
Subject How to make custom XSP-like language??
Date Fri, 31 May 2002 19:19:58 GMT
Hi,

   I'm new to the list, but have been working with Cocoon 1.x and 2 for 
over a year, recently adding lots of custom extensions.

I'm trying to create a new XSP-like language for my application. This 
language needs to have a different base class than XSPGenerator, and 
some changes are needed to the xsp.xsl logicsheet so that I can change 
how the generate() method is created.

I've got a prototype up and running with a few hacks that might be 
interesting to the list. First, I changed xsp.xsl so that I can specify 
a base-class attribute for xsp:page. (I'll append the changes to the 
bottom of this email). If none exists it uses XSPGenerator. Second, I 
created an XMLPipe that changes the SAX events to behave the way I need 
them. So far it's working but to implement some more advanced features I 
will need to change xsp.xsl more than I would like. I'm worried that I 
wouldn't be able to update my Cocoon installation if xsp.xsl was 
modified.

So I'd like to use my own stylesheet instead of xsp.xsl, but still keep 
xsp.xsl and the xsp sections of cocoon.conf as distributed so that 
normal xsp pages would still work. I can't find any documentation on 
this.

I'd imagine that I'd need to add something like this to cocoon.xconf:

   <markup-languages>
     <xsp-language name="MyML">
       <parameter name="prefix" value="mml"/>
       <parameter name="uri" value="http://paraliansoftware.com/myml"/>
       <target-language name="java">
         <parameter name="core-logicsheet" 
value="resource://com/paralian/myml/myml.xsl"/>
       </target-language>
     </xsp-language>

But should this really be in an xsp-language tag, or in a myml-language 
tag? And once I did this would I just pass "myml" to 
ProgramGenerator.load() and it would choose the right core logicsheet?

Thanks,
   Justin

Changes to xsp.xsl:
....
		<xsl:variable name="base-class">
		  <xsl:choose>
		    <xsl:when test="@base-class">
		      <xsl:value-of select="@base-class"/>
		    </xsl:when>
		    <xsl:otherwise>
		      XSPGenerator
		    </xsl:otherwise>
		  </xsl:choose>
		</xsl:variable>

     /**
      * Generated by XSP. Edit at your own risk, :-)
      */
     public class <xsl:value-of select="@file-name"/> extends 
<xsl:value-of select="$base-class"/> {
....


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message