Generally the way I do logicsheets and XSP is as follows:

* start with a regular XML document

* run a logicsheet against it, to add logic for certain tags in the XML.  Result is an 
XSP page.  This is done at compile time, outside of Cocoon (i.e., using Ant and Xalan).

* The XSP page is executed in Cocoon at run-time, and then I run another style sheet 
against the result to format the output (for HTML, in my case)


You don't have to do it this way, but it works for me.


If you do this, it should work:

* get rid of everything in your "XSP page" except for what's within the 
<mail:execute-query> element

* Also get rid of the <xsp:expr> stuff (for now) and just use the hard-coded values 
directly in the <mail:host> and other similar elements.

* change the extension to xml.  it's not an xsp page.  The intention is that this 
document should contain nothing but just plain XML - no logic.

* add some stuff to your logichsheet - the resulting xsp page that will be generated 
needs to start with <xsp:page>, needs a root element

* run xalan to apply your logicsheet to this xml doc.  The result will be an xsp page

* now you can run that xsp page via a generator in cocoon, then transform it, and 
finally serialize it


HTH.

DR



At 03:54 PM 11/20/01 +0100, you wrote:
>Hi!
>I am new to cocoon and xsp and logicsheets. I want to use a mail logicsheet
>in order to display mails on a browser. I don't know exactly how to use this
>logicsheet and how to handle the parameters.
>I will attach the logicsheet and my xsp-file to show what I mean
>exactly.Maybe I my xsp-file is completely wrong ?!
>
>I would be very happy for an answer to my question!!!
>
>mail logicsheet:
><xsl:template match="mail:execute-query">
>  <xsl:variable name="protocol">
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:protocol"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:variable name="host">
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:host"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:variable name="port">    <!-- POP3 is conventionally on port 110 -->
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:port"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:variable name="username">
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:username"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:variable name="password">
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:password"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:variable name="mbox">
>   <xsl:call-template name="get-nested-string">
>    <xsl:with-param name="content" select="mail:mbox"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsp:logic>
>   {
>    Properties _mail_properties = new Properties();
>    Session _mail_session =
>Session.getDefaultInstance(_mail_properties,null);
>    <xsl:choose>
>     <xsl:when test="$protocol">
>      Store _mail_store = _mail_session.getStore(String.valueOf(<xsl:copy-of
>select="$protocol"/>));
>     </xsl:when>
>     <xsl:otherwise>
>      Store _mail_store = _mail_session.getStore();
>     </xsl:otherwise>
>    </xsl:choose>
>    Integer _mail_port = null;
>    try {
>     _mail_port = new Integer(String.valueOf(<xsl:copy-of select="$port"/>));
>    } catch (Exception e) {}
>    _mail_store.connect(
>     String.valueOf(<xsl:copy-of select="$host"/>),
>     _mail_port == null ? -1 : _mail_port.intValue(),
>     String.valueOf(<xsl:copy-of select="$username"/>),
>     String.valueOf(<xsl:copy-of select="$password"/>));
>    Folder _mail_folder = _mail_store.getDefaultFolder();
>    _mail_folder = _mail_folder.getFolder(String.valueOf(<xsl:copy-of
>select="$mbox"/>));
>    _mail_folder.open(Folder.READ_WRITE);
>    <xsl:apply-templates select="mail:results/*"/>
>    _mail_folder.close(false);
>    _mail_store.close();
>   }
>  </xsp:logic>
></xsl:template>
>
>and this is my xsp-file:
><logic>
>                 String POP3="POP3";
>                 String localhost="localhost";
>                 String portm="110";
>                 String test="test";
>                 String inbox="inbox";
>
>                 </logic>
><content>
><mail:execute-query>
>                                 <mail:protocol>
>                                         <xsp:expr>POP3</xsp:expr>
>                                 </mail:protocol>
>                                 <mail:host>
>                                         <xsp:expr>localhost</xsp:expr>
>                                 </mail:host>
>                                 <mail:port>
>                                         <xsp:expr>portm</xsp:expr>
>                                 </mail:port>
>                                 <mail:username>
>                                         <xsp:expr>test</xsp:expr>
>                                 </mail:username>
>                                 <mail:password>
>                                         <xsp:expr>test</xsp:expr>
>                                 </mail:password>
>                                 <mail:mbox>
>                                         <xsp:expr>inbox</xsp:expr>
>                                 </mail:mbox>
>                         </mail:execute-query>
></content>
>
>
>
>---------------------------------------------------------------------
>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: <[EMAIL PROTECTED]>
>For additional commands, e-mail: <[EMAIL PROTECTED]> 


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to