cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <paint...@mc.duke.edu>
Subject Re: Weird logicsheet problem
Date Mon, 27 Oct 2003 15:36:58 GMT




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"|
|         |           <jonnybecker@hotm|
|         |           ail.com>         |
|         |                            |
|         |           10/27/2003 10:27 |
|         |           AM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                       |
  |       To:       users@cocoon.apache.org                                              
                       |
  |       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: 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