cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [C2] Custom Logicsheets
Date Fri, 06 Jul 2001 12:55:54 GMT
"Morrison, John" wrote:
> 
> Berin,
> 
> I've got a logicsheet in and working - at least adding it's functions to the
> java output.  However (there's always a however in these things... ;) when I
> apply _my_ logicsheet and esql the Java output'd by my sheet fails to
> compile.  Do you (or anybody else) have an example of a logicsheet which
> puts some functions outside of the content and still works after esql has
> been applied?
> 
> My logicsheet looks (something) like this...


In your logicsheet, you need an explicit template that looks like this:

<xsl:template match="node()|@*" priority="-1">
  <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
</xsl:template>

This allows the logicsheets to be neetly cascading.

> 
> <?xml version="1.0"?>
> 
> <xsl:stylesheet version="1.0"
>         xmlns:xsp="http://apache.org/xsp"
>         xmlns:factor="http://experian.com/xsp/factor/1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
> 
> <xsl:template match="xsp:page">
>         <xsp:page>
>                 <xsl:apply-templates select="@*"/>
> 
>                 <xsp:logic>
>                         private String factoredFunctionality() {
>                                 return "Success!";
>                         }
>                         }
>                 </xsp:logic>
> 
>                 <xsl:apply-templates/>
> 
>         </xsp:page>
> </xsl:template>
> 
> <xsl:template match="factor:factored">
>         <xsp:expr>factoredFunctionality()</xsp:expr>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> The java is more complicated than this, but I don't think my boss would like
> me to post it :D
> 
> Any help (as always) gratefully received.
> 
> J.
> 
> > -----Original Message-----
> > From: Berin Loritsch [mailto:bloritsch@apache.org]
> > Sent: Thursday, 05 July 2001 14:04
> > To: cocoon-dev@xml.apache.org
> > Subject: Re: [C2] Custom Logicsheets
> >
> >
> > "Morrison, John" wrote:
> > >
> > > Hi All,
> > >
> > > I *know* I really should have written some of these before
> > now but... All
> > > the documentation refers to C1 use of logicsheets.  How do
> > I tell C2 one
> > > exists and where is the best place to put the xslt (ie
> > somewhere under
> > > WEB-INF)?
> >
> > I usually place my custom logicsheets in the following location:
> >
> > ${context}/WEB-INF/logicsheets/
> >
> >
> > You tell Cocoon 2 that they exist using the following snippet
> > in Cocoon.xconf:
> >
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="my-sheet"/>
> >           <parameter name="uri" value="http://my.org/xsp/sheet/1.0"/>
> >           <parameter name="href"
> > value="context://WEB-INF/logicsheets/my-sheet.xsl"/>
> >         </builtin-logicsheet>
> >
> >
> > You place it in the Cocoon.xconf file under
> > "markup-languages" like the following snippet:
> >
> >
> >   <markup-languages>
> >     <component-instance name="xsp"
> > class="org.apache.cocoon.components.language.markup.xsp.XSPMar
> > kupLanguage">
> >       <parameter name="prefix" value="xsp"/>
> >       <parameter name="uri" value="http://apache.org/xsp"/>
> >
> >       <target-language name="java">
> >         <parameter name="core-logicsheet"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/xsp.xsl"/>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="xsp-request"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/request/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/request.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="xsp-response"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/response/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/response.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="session"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/session/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/session.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="xsp-cookie"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/cookie/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/cookie.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="esql"/>
> >           <parameter name="uri"
> > value="http://apache.org/cocoon/SQL/v2"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/esql.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="log"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/log/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/log.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="util"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/util/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/util.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="xsp-formval"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/form-validator/2.0"/>
> >           <parameter name="href"
> > value="resource://org/apache/cocoon/components/language/markup
> > /xsp/java/form-validator.xsl"/>
> >         </builtin-logicsheet>
> >
> >         <builtin-logicsheet>
> >           <parameter name="prefix" value="soap"/>
> >           <parameter name="uri"
> > value="http://apache.org/xsp/soap/2.0"/>
> >           <parameter name="href"
> > value="context://docs/samples/soap/soap-lib.xsl"/>
> >         </builtin-logicsheet>
> >
> >       </target-language>
> >     </component-instance>
> >
> >     <component-instance name="sitemap"
> > class="org.apache.cocoon.components.language.markup.sitemap.Si
> > temapMarkupLanguage">
> >       <parameter name="prefix" value="map"/>
> >       <parameter name="uri"
> > value="http://apache.org/cocoon/sitemap/1.0"/>
> >
> >       <target-language name="java">
> >         <parameter name="core-logicsheet"
> > value="resource://org/apache/cocoon/components/language/markup
> > /sitemap/java/sitemap.xsl"/>
> >       </target-language>
> >     </component-instance>
> >   </markup-languages>
> >
> 
> =======================================================================
> Information in this email and any attachments are confidential, and may
> not be copied or used by anyone other than the addressee, nor disclosed
> to any third party without our permission.  There is no intention to
> create any legally binding contract or other commitment through the use
> of this email.
> 
> Experian Limited (registration number 653331).
> Registered office: Talbot House, Talbot Street, Nottingham NG1 5HF
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
Mime
View raw message