You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Aurelien <au...@fractals.be> on 2001/10/04 21:52:25 UTC

nested stylesheets

Hi,

(sorry if this kindof a repost, I didn't see the message on the list, 
and neither did it show in my sent items...)

I've already managed to have some ejb's basically exposed as taglibs. 
Now, I'd like to be able to nest custom tags:

I have a method that checks if a user has certain rights (I do this in 
order to have a centralized session/roles mechanism so as to be able to 
have several servlet engines sharing a common set of users), for example 
with a tag like this:

<gatekeeper:checkUser sessionId="..." requestId="..."/>

And I have another bean that provides information about sport events:

<infokiosk:getSoccerScore matchId="..."/>

I'd like to be able to nest tags, so I can delegate basic logic to XML 
authors that don't want to hear about programming. They'd do something 
like this (in an xsp document):

<infokiosk:getSoccerScore matchId="...">
   <infokiosk:checkAccess>
     <gatekeeper:checkUser sessionId="..." requestId="..."/>
   </infokiosk:checkAccess>
</infokiosk:getSoccerScore>

Has someone already tried this ?

I looked into util.xsl, but I couldn't understand how they implement a 
similar example which is documented in cocoon2's online help.

Any help is greatly appreciated !

Aurélien


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: nested stylesheets

Posted by Candide Kemmler <ca...@urbanium.tv>.
Thanks for your answer. Yes, it helps !


Le vendredi 5 octobre 2001, à 10:02 AM, Adrian Geissel a écrit :

> Hi,
>
> The issue with logicsheet XSLs is that they should translate what they
> understand and pass through what they don't. This in effect is how the
> embedded tags are resolved, when all logic sheets are run against the 
> XSP
> file. Any tags that are left over are output in the resulting Document
> (logically).
>
> To make this happen, there are two minimum requirements for your 
> logicsheet.
>
> Firstly, provide a template that processes the <xsp:page/> element, 
> which in
> turn creates an <xsp:page/> element as a root context for the follow-on
> logicsheets. For example:
>   <xsl:template match="xsp:page">
>     <xsp:page>
>       <xsl:apply-templates select="@*"/>
>       <xsl:apply-templates/>
>     </xsp:page>
>   </xsl:template>
>
>
> and Secondly, to ensure that all unprocessed elements are copied, 
> include
> the following template in your logicsheet:
>
>   <!-- copied from [C2] util.xsl  -->
>   <xsl:template match="@*|*|text()|processing-instruction()">
>     <xsl:copy>
>       <xsl:apply-templates 
> select="@*|*|text()|processing-instruction()"/>
>     </xsl:copy>
>   </xsl:template>
>
>
> Hope this helps,
> Adrian
>
> ----- Original Message -----
> From: Aurelien <au...@fractals.be>
> To: <co...@xml.apache.org>
> Sent: Thursday, October 04, 2001 8:52 PM
> Subject: nested stylesheets
>
>
>> Hi,
>>
>> (sorry if this kindof a repost, I didn't see the message on the list,
>> and neither did it show in my sent items...)
>>
>> I've already managed to have some ejb's basically exposed as taglibs.
>> Now, I'd like to be able to nest custom tags:
>>
>> I have a method that checks if a user has certain rights (I do this in
>> order to have a centralized session/roles mechanism so as to be able to
>> have several servlet engines sharing a common set of users), for 
>> example
>> with a tag like this:
>>
>> <gatekeeper:checkUser sessionId="..." requestId="..."/>
>>
>> And I have another bean that provides information about sport events:
>>
>> <infokiosk:getSoccerScore matchId="..."/>
>>
>> I'd like to be able to nest tags, so I can delegate basic logic to XML
>> authors that don't want to hear about programming. They'd do something
>> like this (in an xsp document):
>>
>> <infokiosk:getSoccerScore matchId="...">
>>    <infokiosk:checkAccess>
>>      <gatekeeper:checkUser sessionId="..." requestId="..."/>
>>    </infokiosk:checkAccess>
>> </infokiosk:getSoccerScore>
>>
>> Has someone already tried this ?
>>
>> I looked into util.xsl, but I couldn't understand how they implement a
>> similar example which is documented in cocoon2's online help.
>>
>> Any help is greatly appreciated !
>>
>> Aurélien
>>
>>
>> ---------------------------------------------------------------------
>> Please check that your question has not already been answered in the
>> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>> To unsubscribe, e-mail: <co...@xml.apache.org>
>> For additional commands, e-mail: <co...@xml.apache.org>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: nested stylesheets

Posted by Adrian Geissel <ag...@zenark.com>.
Hi,

The issue with logicsheet XSLs is that they should translate what they
understand and pass through what they don't. This in effect is how the
embedded tags are resolved, when all logic sheets are run against the XSP
file. Any tags that are left over are output in the resulting Document
(logically).

To make this happen, there are two minimum requirements for your logicsheet.

Firstly, provide a template that processes the <xsp:page/> element, which in
turn creates an <xsp:page/> element as a root context for the follow-on
logicsheets. For example:

  <xsl:template match="xsp:page">
    <xsp:page>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsp:page>
  </xsl:template>


and Secondly, to ensure that all unprocessed elements are copied, include
the following template in your logicsheet:

  <!-- copied from [C2] util.xsl  -->
  <xsl:template match="@*|*|text()|processing-instruction()">
    <xsl:copy>
      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    </xsl:copy>
  </xsl:template>


Hope this helps,
Adrian

----- Original Message -----
From: Aurelien <au...@fractals.be>
To: <co...@xml.apache.org>
Sent: Thursday, October 04, 2001 8:52 PM
Subject: nested stylesheets


> Hi,
>
> (sorry if this kindof a repost, I didn't see the message on the list,
> and neither did it show in my sent items...)
>
> I've already managed to have some ejb's basically exposed as taglibs.
> Now, I'd like to be able to nest custom tags:
>
> I have a method that checks if a user has certain rights (I do this in
> order to have a centralized session/roles mechanism so as to be able to
> have several servlet engines sharing a common set of users), for example
> with a tag like this:
>
> <gatekeeper:checkUser sessionId="..." requestId="..."/>
>
> And I have another bean that provides information about sport events:
>
> <infokiosk:getSoccerScore matchId="..."/>
>
> I'd like to be able to nest tags, so I can delegate basic logic to XML
> authors that don't want to hear about programming. They'd do something
> like this (in an xsp document):
>
> <infokiosk:getSoccerScore matchId="...">
>    <infokiosk:checkAccess>
>      <gatekeeper:checkUser sessionId="..." requestId="..."/>
>    </infokiosk:checkAccess>
> </infokiosk:getSoccerScore>
>
> Has someone already tried this ?
>
> I looked into util.xsl, but I couldn't understand how they implement a
> similar example which is documented in cocoon2's online help.
>
> Any help is greatly appreciated !
>
> Aurélien
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>