Hi,

now I changed the logicsheet:
__________________________________________________________________________________
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xsp="http://apache.org/xsp"; xmlns:jonny="http://jonny.de/jonny";>
<xsl:template match="xsp:page">
<xsp:page>
<xsl:apply-templates select="@*"/>
<xsp:structure>
<xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
<xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
</xsp:structure>
<xsl:apply-templates select="node()"/>
</xsp:page>
</xsl:template>
<xsl:template match="jonny:test">
<xsp:logic>
File uploadDir = null;
/** Contextualize this class */
public void contextualize(Context context) throws ContextException {
uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR);
}
String[] filelist = uploadDir.list();
</xsp:logic>
<xsp:expr>filelist[0]</xsp:expr>
</xsl:template>
<xsl:template match="@*|node()" priority="-2">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


But it still throws an error:
______________________________________________________________________________
An Error Occurred
Language Exception

org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Error compiling jonny_xsp: ERROR 1 (org\apache\cocoon\www\logicsheet\jonny_xsp.java): ... this.characters("\n\t\t"); File uploadDir = null; /** Contextualize this class */ // start error (lines 112-112) "Syntax error on token "(", ";" expected" public void contextualize(Context context) throws ContextException { // end error uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } String[] filelist = uploadDir.list(); ... Line 112, column 0: Syntax error on token "(", ";" expected

cause: org.apache.cocoon.components.language.LanguageException: Error compiling jonny_xsp: ERROR 1 (org\apache\cocoon\www\logicsheet\jonny_xsp.java): ... this.characters("\n\t\t"); File uploadDir = null; /** Contextualize this class */ // start error (lines 112-112) "Syntax error on token "(", ";" expected" public void contextualize(Context context) throws ContextException { // end error uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } String[] filelist = uploadDir.list(); ... Line 112, column 0: Syntax error on token "(", ";" expected

full exception chain stacktrace[hide]

Original Exception: org.apache.cocoon.components.language.LanguageException: Error compiling jonny_xsp:
ERROR 1 (org\apache\cocoon\www\logicsheet\jonny_xsp.java):
...
this.characters("\n\t\t");


File uploadDir = null;

/** Contextualize this class */


// start error (lines 112-112) "Syntax error on token "(", ";" expected" public void contextualize(Context context) throws ContextException {


// end error uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR);

}

String[] filelist = uploadDir.list();

...
Line 112, column 0: Syntax error on token "(", ";" expected

at org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:236)

at org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage.java:208)

at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.loadProgram(ProgramGeneratorImpl.java:427)
_______________________________________________________________-


The strange thing here is (in my opinion) that I got these errors before in my xsp's with the same code. But now they're gone in the xsp's and I have em in the logicsheet.

Thanks
jonny



From: Christopher Painter-Wakefield <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Weird logicsheet problem
Date: Mon, 27 Oct 2003 10:36:58 -0500





A logicsheet must first be an XSLT stylesheet.  Yours is not, because you
have <xsp:structure> elements in your stylesheet.  If you want these to be
in your xsp program, you need to put them in a template like this:

<xsl:template match="xsp:page">
  <xsp:page>
     <xsl:apply-templates select="@*"/>
     <xsp:structure>
       <xsp:include>....
     </xsp:structure>
     <xsl:apply-templates select="node()"/>
  </xsp:page>
</xsl:template>

For this to work, you also need a default template to copy things, such as
this one:
<xsl:template match="@*|node()" priority="-2">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

or include the logicsheets-util.xsl which has this template, I believe.

-Christopher




|---------+---------------------------->
| | "Johannes Becker"|
| | <[EMAIL PROTECTED]|
| | ail.com> |
| | |
| | 10/27/2003 10:27 |
| | AM |
| | Please respond to|
| | users |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------|
| |
| To: [EMAIL PROTECTED] |
| cc: |
| Subject: Weird logicsheet problem |
>--------------------------------------------------------------------------------------------------------------|





Hi,


I'm having problems getting my logicsheet to work. It always throws errors.
I had these errors with the same code before in xsp's, but they don't occur

anymore.
This code works fine in an xsp.


My logicsheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xsp="http://apache.org/xsp"; xmlns:party="http://jonny.de/";> <xsp:structure>

<xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>


<xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>


             </xsp:structure>
             <xsl:template match="jonny:test">
                         <xsp:logic>
                                       File uploadDir = null;
                                       public void contextualize(Context
context) throws ContextException {
                                         uploadDir = (File)
context.get(Constants.CONTEXT_UPLOAD_DIR);
                                       }
                               String[] filelist = uploadDir.list();
                         </xsp:logic>
                                      <xsp:expr>filelist[1]</xsp:expr>
                         </xsl:template>
             <xsl:template name="get-nested-content">
                         <xsl:param name="content"/>
                         <xsl:choose>
                                     <xsl:when test="$content/*">
                                                 <xsl:apply-templates
select="$content/*"/>
                                     </xsl:when>
                                     <xsl:otherwise>"<xsl:value-of
select="$content"/>"</xsl:otherwise>
                         </xsl:choose>
             </xsl:template>
             <xsl:template match="@*|*|text()|processing-instruction()">
                         <xsl:copy>
                                     <xsl:apply-templates
select="@*|*|text()|processing-instruction()"/>
                         </xsl:copy>
             </xsl:template>
</xsl:stylesheet>

The error:
An Error Occurred
Language Exception

org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling
zufall_xsp: ERROR 1 (org\apache\cocoon\www\logicsheet\zufall_xsp.java): ...

this.characters("\n\t\t"); File uploadDir = null; // start error (lines
107-107) "Syntax error on token "(", ";" expected" public void
contextualize(Context context) throws ContextException { // end error
uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } String[]
filelist = uploadDir.list(); ... Line 107, column 0: Syntax error on token
"(", ";" expected

cause: org.apache.cocoon.components.language.LanguageException: Error
compiling zufall_xsp: ERROR 1
(org\apache\cocoon\www\logicsheet\zufall_xsp.java): ...
this.characters("\n\t\t"); File uploadDir = null; // start error (lines
107-107) "Syntax error on token "(", ";" expected" public void
contextualize(Context context) throws ContextException { // end error
uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); } String[]
filelist = uploadDir.list(); ... Line 107, column 0: Syntax error on token
"(", ";" expected

full exception chain stacktrace[hide]

Original Exception:
org.apache.cocoon.components.language.LanguageException:
Error compiling jonny_xsp:
ERROR 1 (org\apache\cocoon\www\logicsheet\zufall_xsp.java):
...
        this.characters("\n\t\t");
                                       File uploadDir = null;


// start error (lines 107-107) "Syntax error on token "(", ";" expected" public void contextualize(Context context) throws ContextException {


// end error uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR);

}

                               String[] filelist = uploadDir.list();
...
Line 107, column 0: Syntax error on token "(", ";" expected

             at
org.apache.cocoon.components.language.programming.java.JavaLanguage.compile(JavaLanguage.java:236)


at org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage.load(CompiledProgrammingLanguage.java:208)


at org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.loadProgram(ProgramGeneratorImpl.java:427)




Regards Jonny

_________________________________________________________________
5 neue Buddies = 50 FreeSMS. http://messenger-mania.msn.de MSN Messenger
empfehlen und kr�ftig abr�umen!


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
NEU: Polyphone Klingelt�ne und farbige Logos f�r Ihr Handy! http://polyphonetoene.handy.msn.de Jetzt Handy aufpeppen!



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to