cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Bruns" <br...@dialog.uni-oldenburg.de>
Subject RE: RES: RES: XSP in XSL
Date Mon, 22 Sep 2003 07:05:53 GMT

Hi,

what you could do is using one matcher to generate your XSP and use a
second one to get this generated XSP executed. Something like

<map:pipeline>

     <map:match type="wildcard" pattern="*.xsp">
          <map:generate src="yourBasicXML.xml"/>
          <map:transform src="yourXSPGeneratingXSL.xsl"/>
          <map:serialize type="xml"/>
     </map:match>

     <map:match type="wildcard" pattern="*.html">
          <map:generate type="serverpages" src="cocoon:/{1}.xsp"/><!-- This
calls the upper matcher, see 'cocoon protocols' -->
          <map:serialize type="html"/>
     </map:match>

</map:pipeline>

should work. But you should be aware of generating XSP (especially
dynamically generating XSP, eg. depending on some input parameters) results
in compiling a new XSP each time you call your pipeline.

HTH, Kai



                                                                                         
                                       
                    "Jose Antonio                                                        
                                       
                    Rosa dos             An:     <users@cocoon.apache.org>         
                                             
                    Santos               Kopie:                                          
                                       
                    Junior"              Thema:  RES: RES: XSP in XSL                    
                                       
                    <JoseS@fnde.g                                                     
                                          
                    ov.br>                                                            
                                          
                                                                                         
                                       
                    19.09.2003                                                           
                                       
                    19:24                                                                
                                       
                    Bitte                                                                
                                       
                    antworten an                                                         
                                       
                    users                                                                
                                       
                                                                                         
                                       
                                                                                         
                                       




Thanx Luca. I´ll try that.

I saw somewhere an example of a pipeline using 2 matchers and i thought i
could use the output of a serializer as an input of the generator of the
next matcher.

Cheers

Jose Antonio

-----Mensagem original-----
De: Luca Morandini [mailto:luca.morandini1@tin.it]
Enviada em: sexta-feira, 19 de setembro de 2003 13:46
Para: users@cocoon.apache.org
Assunto: Re: RES: XSP in XSL


Jose Antonio Rosa dos Santos Junior wrote:

> hmmm.. Maybe. Haven´t thought that way. Can i link two pipelines to do
that instead?
>
> I´m sending what i am trying to do:
>
> stemap.xmap:
> ...
>   <map:pipeline>
>     <map:match type="wildcard" pattern="*.xsp">
>       <map:generate type="serverpages" src="{1}.xsp"/>
>            <map:transform type="xslt" src="pagina-fnde2html.xsl"/>
>       <map:serialize type="html"/>
>     </map:match>
>   </map:pipeline>
> ...
>
> pagina-fnde2html.xsl:
> ...
>          <xsl:template match="pagina">
>          ...
>          <!-- this doesn´t work -->
>          <xsp:logic>
>                    SimpleDateFormat format = new SimpleDateFormat
("dd/MM/yyyy");
>          </xsp:logic>
>          <xsp:expr>
>                    format.format(new Date())
>          </xsp:expr>
>          ...
>          </xsl:template>
> ...
>
> teste.xsp:
>
> <?xml version='1.0' encoding='ISO-8859-1'?>
> <xsp:page
>   xmlns:xsp="http://apache.org/xsp"
>
>

No, you cannot.

Specifically, you cannot use XSP tags in your XSL: XSP is interpreted
only in the generation stage.
What XSL does is just to transform (using the XSL language, not the XSP
one) the output produced by the XSP.

If you really can't do without Java in the XSL, take a look at the XSL
extension of Xalan, using which you will be able call Java within an
XSL, like:

<xsl:stylesheet version="1.0"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:fo="http://www.w3.org/1999/XSL/Format"
           xmlns:java="http://xml.apache.org/xslt/java"
 >
...
                <xsl:variable name="formatter"

select="java:java.text.SimpleDateFormat.new('dd-MM-yyyy')"/>
<xsl:variable name="date"
                               select="java:java.util.Date.new()"/>
<xsl:value-of select="java:format($formatter, $date)"/>
...

...which, coincidentally, you were trying to achieve in the first place
   I suppose :)

Regards,

------------------------------------------
                Luca Morandini
                GIS Consultant
               lmorandini@ieee.org
http://space.virgilio.it/kumora/index.html
------------------------------------------



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


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














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


Mime
View raw message