You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kevin J Walters <ke...@msdw.com> on 2000/09/05 00:38:11 UTC

xsp in xml and xsl at same time doesn't work?

Hi,

I've been doing some experimenting today to try and determine the
source of a problem i'm having.

If i have an xsp page which is processed by an xsl file, it all
works. If i have an xml file which is processed by an xsp'ed xsl
thing, it still works. If i mix both together then i just get a
timeout when i try to load the page (and i'd guess the something is
infinite looping in the jvm judging by the server load).

A short example follows below. Should this all work (in 1.7.4) or is
there something fundamental i'm missing here? The truss of the process
shows it doing continual readlinks and stats of the files as if it is
constantly serving requests for the same page.

Cocoon 1.7.4 on solaris 2.5.1, netscape enterprise server 3.6.3 and
new atlana's servletexec 2.2.

$ cat test5.cxml 
<?xml version="1.0"?>

<?xml-stylesheet href="test5-xsp.xsl" type="text/xsl"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
  <test5>
    <title>test5</title>
    <text>
      <xsp:logic>
        String astring = "html";
        <xsp:content><xsp:expr>"This test produces the xml using a java" +
                               " xsp page and processes it using " +
                               " an xslt transformation using xsp " +
                               " extensions to include java processing. " +
                               "Output is " + astring + '.'
                     </xsp:expr></xsp:content>
      </xsp:logic>
    </text>
  </test5>
</xsp:page>


And the xsl,

$ cat test5-xsp.xsl 
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsp="http://www.apache.org/1999/XSP/Core">

  <xsl:template match="test5">  <!-- root -->
    <xsl:processing-instruction name="cocoon-process">type="xsp"</xsl:processing-instruction>
    <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
     
    <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
      <xsp:logic>
        String extratext = " This line added by java code in xslt.";
      </xsp:logic>
    <html>
      <title><xsl:value-of select="title"/></title>
      <body>
        <p><xsl:value-of select="text"/> <xsp:logic><xsp:content><xsp:expr>extratext</xsp:expr></xsp:content></xsp:logic></p>
      </body>
    </html>

    </xsp:page>

  </xsl:template>  <!-- match="test5" -->

</xsl:stylesheet>


regards

|<evin

-- 
Kevin J Walters                      Morgan Stanley Dean Witter
kevin.walters@msdw.com, kjw@acm.org  750 Seventh Avenue
Tel: 212 762 1752                    New York
Fax: 212 762 0174                    NY 10019

RE: xsp in xml and xsl at same time doesn't work?

Posted by Per Kreipke <pe...@onclave.com>.
Christopher,

Can you post a small snippet to illustrate what you mean? I'd love to be
able to do the same 'compositing' that you mention.

Per.

> -----Original Message-----
> From: Christofer Dutz [mailto:christofer.dutz@danet.de]
> Sent: Wednesday, September 06, 2000 5:35 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: xsp in xml and xsl at same time doesn't work?
>
>
> > Hi,
> > I've been doing some experimenting today to try and determine the
> > source of a problem i'm having.
> > If i have an xsp page which is processed by an xsl file, it all
> > works. If i have an xml file which is processed by an xsp'ed xsl
> > thing, it still works. If i mix both together then i just get a
> > timeout when i try to load the page (and i'd guess the something is
> > infinite looping in the jvm judging by the server load).
>
> Hmmm, sounds like the problem I had a few days ago. Do I understand right.
> You have a XML-File with XSP-Logic and a XSL wich creates a XSP-document,
> which schould again be processed by the XSP-engine ?
>
> Well this isn't possible with Cocooon ( don't start crying now as
> I did last
> week :-) )
> Sometimes you can build up a workaround by delaying the XSP-Code
> execution.
> If you build your XML-File as a normal XML-File ( no XSP
> processing-instructions
> and no xsp:page-element)
> and simply include the XSP-namespace to it, you can write your usual
> XSP-code into
> the page. In your XSL-file you can now fodify it to create a valid
> XSP-document and
> simply copy in the content of your XML-file. By doing this your code is
> executed with
> the one of the XSL-file. This worked fine for me but only works if the
> processing in the
> "second" XSP doesn't depend on the content of the first. ( I simply used
> this to add login and
> permission-information to every page used )
>
> Have phun,
>     Christofer Dutz
>
> > A short example follows below. Should this all work (in 1.7.4) or is
> > there something fundamental i'm missing here? The truss of the process
> > shows it doing continual readlinks and stats of the files as if it is
> > constantly serving requests for the same page.
>
> > Cocoon 1.7.4 on solaris 2.5.1, netscape enterprise server 3.6.3 and
> > new atlana's servletexec 2.2.
> >
> > $ cat test5.cxml
> > <?xml version="1.0"?>
> >
> > <?xml-stylesheet href="test5-xsp.xsl" type="text/xsl"?>
> >
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> >
> > <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> >   <test5>
> >     <title>test5</title>
> >     <text>
> >       <xsp:logic>
> >         String astring = "html";
> >         <xsp:content><xsp:expr>"This test produces the xml
> using a java" +
> >                                " xsp page and processes it using " +
> >                                " an xslt transformation using xsp " +
> >                                " extensions to include java
> processing. "
> +
> >                                "Output is " + astring + '.'
> >                      </xsp:expr></xsp:content>
> >       </xsp:logic>
> >     </text>
> >   </test5>
> > </xsp:page>
> >
> >
> > And the xsl,
> >
> > $ cat test5-xsp.xsl
> > <?xml version="1.0"?>
> >
> > <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> >
> >   <xsl:template match="test5">  <!-- root -->
> >     <xsl:processing-instruction
> name="cocoon-process">type="xsp"</xsl:processing-instruction>
> >     <xsl:processing-instruction
> name="cocoon-format">type="text/html"</xsl:processing-instruction>
> >
> >     <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> >       <xsp:logic>
> >         String extratext = " This line added by java code in xslt.";
> >       </xsp:logic>
> >     <html>
> >       <title><xsl:value-of select="title"/></title>
> >       <body>
> >         <p><xsl:value-of select="text"/>
> <xsp:logic><xsp:content><xsp:expr>extratext</xsp:expr></xsp:conten
> t></xsp:lo
> gic></p>
> >       </body>
> >     </html>
> >
> >     </xsp:page>
> >
> >   </xsl:template>  <!-- match="test5" -->
> >
> > </xsl:stylesheet>
> >
> >
> > regards
> >
> > |<evin
> >
> > --
> > Kevin J Walters                      Morgan Stanley Dean Witter
> > kevin.walters@msdw.com, kjw@acm.org  750 Seventh Avenue
> > Tel: 212 762 1752                    New York
> > Fax: 212 762 0174                    NY 10019
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


Re: xsp in xml and xsl at same time doesn't work?

Posted by Christofer Dutz <ch...@danet.de>.
> Hi,
> I've been doing some experimenting today to try and determine the
> source of a problem i'm having.
> If i have an xsp page which is processed by an xsl file, it all
> works. If i have an xml file which is processed by an xsp'ed xsl
> thing, it still works. If i mix both together then i just get a
> timeout when i try to load the page (and i'd guess the something is
> infinite looping in the jvm judging by the server load).

Hmmm, sounds like the problem I had a few days ago. Do I understand right.
You have a XML-File with XSP-Logic and a XSL wich creates a XSP-document,
which schould again be processed by the XSP-engine ?

Well this isn't possible with Cocooon ( don't start crying now as I did last
week :-) )
Sometimes you can build up a workaround by delaying the XSP-Code execution.
If you build your XML-File as a normal XML-File ( no XSP
processing-instructions
and no xsp:page-element)
and simply include the XSP-namespace to it, you can write your usual
XSP-code into
the page. In your XSL-file you can now fodify it to create a valid
XSP-document and
simply copy in the content of your XML-file. By doing this your code is
executed with
the one of the XSL-file. This worked fine for me but only works if the
processing in the
"second" XSP doesn't depend on the content of the first. ( I simply used
this to add login and
permission-information to every page used )

Have phun,
    Christofer Dutz

> A short example follows below. Should this all work (in 1.7.4) or is
> there something fundamental i'm missing here? The truss of the process
> shows it doing continual readlinks and stats of the files as if it is
> constantly serving requests for the same page.

> Cocoon 1.7.4 on solaris 2.5.1, netscape enterprise server 3.6.3 and
> new atlana's servletexec 2.2.
>
> $ cat test5.cxml
> <?xml version="1.0"?>
>
> <?xml-stylesheet href="test5-xsp.xsl" type="text/xsl"?>
>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
>
> <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>   <test5>
>     <title>test5</title>
>     <text>
>       <xsp:logic>
>         String astring = "html";
>         <xsp:content><xsp:expr>"This test produces the xml using a java" +
>                                " xsp page and processes it using " +
>                                " an xslt transformation using xsp " +
>                                " extensions to include java processing. "
+
>                                "Output is " + astring + '.'
>                      </xsp:expr></xsp:content>
>       </xsp:logic>
>     </text>
>   </test5>
> </xsp:page>
>
>
> And the xsl,
>
> $ cat test5-xsp.xsl
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>
>   <xsl:template match="test5">  <!-- root -->
>     <xsl:processing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>
>     <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
>
>     <xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>       <xsp:logic>
>         String extratext = " This line added by java code in xslt.";
>       </xsp:logic>
>     <html>
>       <title><xsl:value-of select="title"/></title>
>       <body>
>         <p><xsl:value-of select="text"/>
<xsp:logic><xsp:content><xsp:expr>extratext</xsp:expr></xsp:content></xsp:lo
gic></p>
>       </body>
>     </html>
>
>     </xsp:page>
>
>   </xsl:template>  <!-- match="test5" -->
>
> </xsl:stylesheet>
>
>
> regards
>
> |<evin
>
> --
> Kevin J Walters                      Morgan Stanley Dean Witter
> kevin.walters@msdw.com, kjw@acm.org  750 Seventh Avenue
> Tel: 212 762 1752                    New York
> Fax: 212 762 0174                    NY 10019
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>