You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Brent L Johnson <br...@bjohnson.net> on 2001/10/18 21:04:13 UTC

Stylesheets using Logicsheets

Can a stylesheet use tags from a custom logicsheet?  I'm still having the
problem with Cocoon generating a NumberFormatException for no apparent
reason.  To get around this, I'm keeping my HTML tags for the header in the
stylesheet (by keeping it there instead of copying it into the logicsheet, I
won't get the exception).

Problem is, the header should look different depending on some Java logic
(i.e. a logicsheet).  Here's a sample of the top portion of my stylesheet...

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
  <xsl:template match="header">
        <table width="760" border="0" cellpadding="0"
        cellspacing="0">
          <tr>
            <td>
              <img src="/images/head_01.gif" width="263" height="66" />
            </td>
         ........
           <td><header:loginButton/></td>
         ........
  </xsl:template>
</xsl:stylesheet>

This generates a namespace error, of course.  I noticed this and added my
custom namespace for my header logicsheet and I no longer got the error.
But, the stylesheet isn't actually making the header:loginButton call to my
logicsheet.  It's simply printing out
<header:loginButton></header:loginButton> in the generated HTML.  In my XML
document I do have that logicsheet specified - heres a quick sample:

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?xml-logicsheet href="aolSchool.xsl"/?>
<?xml-logicsheet href="/common/header-new.xsl"/?>
<?xml-logicsheet href="/common/rightbar.xsl"/?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="/common/main2.xsl" type="text/xsl"?>
<xsp:page language="java"
        xmlns:xsp="http://www.apache.org/1999/XSP/Core"
        xmlns:esql="http://apache.org/cocoon/SQL/v2"
        xmlns:rightbar="http://www.whatever.com/rightbar"
        xmlns:header="http://www.whatever.com/header"
>
<page>
    <title>Test Doc</title>
    <header/>
    <content>
    ....
    </content>
</page>

Is there a way I can accomplish this without having to put the logic in the
XML doc?

Thanks,

- Brent


---------------------------------------------------------------------
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: Stylesheets using Logicsheets

Posted by Luca Morandini <l....@tin.it>.
Brent,

	As far as I know, you can't do this directly, since the XSP generation has
to be the first step in a pipeline (generation).

	Anyhow, what you can do is chaining two pipelines:

1) A pipeline which produces (via transform) an XML file with your tags
(like  <header:loginButton/>) embedded into it

2) A pipeline whose input is pipeline 1 and which has "serverpages" as the
first step

	I know it sounds tricky... but this is the approach I'm using to insert
static parameters (taken from an XML file) into XSP tags, and it works.

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
           +39 0744 598 51    Office
           +39  335 681 02 12 Mobile
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Brent L Johnson [mailto:brent@bjohnson.net]
> Sent: Thursday, October 18, 2001 9:04 PM
> To: Cocoon-Users
> Subject: Stylesheets using Logicsheets
>
>
> Can a stylesheet use tags from a custom logicsheet?  I'm still having the
> problem with Cocoon generating a NumberFormatException for no apparent
> reason.  To get around this, I'm keeping my HTML tags for the
> header in the
> stylesheet (by keeping it there instead of copying it into the
> logicsheet, I
> won't get the exception).
>
> Problem is, the header should look different depending on some Java logic
> (i.e. a logicsheet).  Here's a sample of the top portion of my
> stylesheet...
>
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>   <xsl:template match="header">
>         <table width="760" border="0" cellpadding="0"
>         cellspacing="0">
>           <tr>
>             <td>
>               <img src="/images/head_01.gif" width="263" height="66" />
>             </td>
>          ........
>            <td><header:loginButton/></td>
>          ........
>   </xsl:template>
> </xsl:stylesheet>
>
> This generates a namespace error, of course.  I noticed this and added my
> custom namespace for my header logicsheet and I no longer got the error.
> But, the stylesheet isn't actually making the header:loginButton
> call to my
> logicsheet.  It's simply printing out
> <header:loginButton></header:loginButton> in the generated HTML.
> In my XML
> document I do have that logicsheet specified - heres a quick sample:
>
> <?xml version="1.0"?>
> <?cocoon-process type="xsp"?>
> <?xml-logicsheet href="aolSchool.xsl"/?>
> <?xml-logicsheet href="/common/header-new.xsl"/?>
> <?xml-logicsheet href="/common/rightbar.xsl"/?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet href="/common/main2.xsl" type="text/xsl"?>
> <xsp:page language="java"
>         xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>         xmlns:esql="http://apache.org/cocoon/SQL/v2"
>         xmlns:rightbar="http://www.whatever.com/rightbar"
>         xmlns:header="http://www.whatever.com/header"
> >
> <page>
>     <title>Test Doc</title>
>     <header/>
>     <content>
>     ....
>     </content>
> </page>
>
> Is there a way I can accomplish this without having to put the
> logic in the
> XML doc?
>
> Thanks,
>
> - Brent
>
>
> ---------------------------------------------------------------------
> 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>