> From: Justin Fagnani-Bell [mailto:[EMAIL PROTECTED]]
>
> 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?
Here is the snippet from cocoon.xconf:
<component-instance
class="org.apache.cocoon.components.language.markup.myxsp.MyXSPMarkupLan
guage"
name="myxsp" logger="core.markup.myxsp">
<parameter name="prefix" value="myxsp"/>
<parameter name="uri" value="http://my.org/myxsp"/>
<target-language name="java">
<parameter name="core-logicsheet"
value="resource://org/my/myxsp/java/myxsp.xsl"/>
</target-language>
</component-instance>
If you don't need changes in XSPMarkupLanguage, you can use it instead
of writing MyXSPMarkupLanguage.
In sitemap.xmap:
<map:generator name="myxsp" ...
src="org.apache.cocoon.generation.ServerPagesGenerator">
<markup-language>myxsp</markup-language>
</map:generator>
That's it.
Vadim
> 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: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]