cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <>
Subject RE: How to make custom XSP-like language??
Date Fri, 31 May 2002 19:45:49 GMT
> From: Justin Fagnani-Bell []
> Hi,
>    I'm new to the list, but have been working with Cocoon 1.x and 2
> 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
> 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
> them. So far it's working but to implement some more advanced features
> 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
> 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"
>        <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
> tag? And once I did this would I just pass "myml" to
> ProgramGenerator.load() and it would choose the right core logicsheet?

Here is the snippet from cocoon.xconf:

    name="myxsp" logger="core.markup.myxsp">
  <parameter name="prefix" value="myxsp"/>
  <parameter name="uri" value=""/>
  <target-language name="java">
    <parameter name="core-logicsheet"

If you don't need changes in XSPMarkupLanguage, you can use it instead
of writing MyXSPMarkupLanguage.

In sitemap.xmap:

<map:generator name="myxsp" ...

That's it.


> 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:
> For additional commands, email:

To unsubscribe, e-mail:
For additional commands, email:

View raw message