You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mike Lenyon <mi...@lenyon.com> on 2003/05/11 02:06:32 UTC

logicsheet not producing output

hi all,

i've created a simple logicsheet which compiles without errors and runs without producing an error messages.  however, it isn't producing any output.  here's the logicsheet:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet
    version="1.0"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsp-session="http://apache.org/xsp/session/2.0"
    xmlns:keepsake="http://quotescape.com/keepsake/1.0"
    >
    
    <xsl:template match="xsp:page">
        <xsp:page>
        
            <xsl:apply-templates select="@*"/>
            
            <xsp:structure>
                <xsp:include>java.util.Map</xsp:include>
                <xsp:include>java.util.HashMap</xsp:include>
            </xsp:structure>
            
            <xsp:logic>
                private String getItemProperty(String property) {
                    Map currentItem = (Map)request.getSession(true).getAttribute("current-item");
                
                    currentItem.put("id", "39");
                    currentItem.put("name", "my item");
                    currentItem.put("image", "image name");
                    
                    if (currentItem != null &amp;&amp; !currentItem.isEmpty()) {
                        if (property.equalsIgnoreCase("id"))
                            return currentItem.get("id").toString();
                            
                        else if (property.equalsIgnoreCase("name"))
                            return currentItem.get("name").toString();
                            
                        else if (property.equalsIgnoreCase("image"))
                            return currentItem.get("image").toString();
                    }
                    
                    return "";
                }
            </xsp:logic>
        
            <!-- process the rest of the XSP page -->
            <xsl:apply-templates/>
            
        </xsp:page>
    </xsl:template>
    
    <xsl:template match="keepsake:get-item">
        
        <xsl:choose>
            <xsl:when test="@property = 'id'">
                "<xsp:expr>getItemProperty("id")</xsp:expr>"
            </xsl:when>
            <xsl:when test="@property = 'name'">
                "<xsp:expr>getItemProperty("name")</xsp:expr>"
            </xsl:when>
            <xsl:when test="@property = 'image'">
                "<xsp:expr>getItemProperty("image")</xsp:expr>"
            </xsl:when>
        </xsl:choose>
        
    </xsl:template>
    
    <!-- passthrough all other XML data not matched here -->
    <xsl:template match="node()|@*">
    
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
        </xsl:copy>
        
    </xsl:template>
</xsl:stylesheet>

and here's the xsp that uses it:
<?xml version="1.0" encoding="UTF-8"?>

<xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:keepsake="http://quotescape.com/keepsake/1.0"
    create-session="true"
    >
    
    <current-product>
        <current-item>
            <request-uri><xsp-request:get-uri/></request-uri>
            <id><keepsake:get-item property="id"/></id>
            <name><keepsake:get-item property="name"/></name>
            <image><keepsake:get-item property="image"/></image>
        </current-item>
    </current-product>
</xsp:page>

thanks in advance for any insights you can provide.

Mike Lenyon

Re: logicsheet not producing output

Posted by Mike Lenyon <mi...@lenyon.com>.
you've done it again, joerg!  thanks for helping through these newbie
mistakes.

Mike Lenyon
----- Original Message -----
From: "Joerg Heinicke" <jo...@gmx.de>
To: <co...@xml.apache.org>
Sent: Sunday, May 11, 2003 5:28 AM
Subject: Re: logicsheet not producing output


> Hello Mike,
>
> you seem to have a little problem in your logicsheet. You only copy and
> modify your <xsp:page> element. But the next <current-product> is
> missing an <xsl:apply-templates/> in the pass-through template:
>
>  >     <!-- passthrough all other XML data not matched here -->
>  >     <xsl:template match="node()|@*">
>  >
>  >         <xsl:copy>
>  >             <xsl:apply-templates select="@*"/>
>
> <xsl:apply-templates/>
>
>  >         </xsl:copy>
>  >
>  >     </xsl:template>
>
> Regards,
>
> Joerg
>
> Mike Lenyon wrote:
> > hi all,
> >
> > i've created a simple logicsheet which compiles without errors and runs
> > without producing an error messages.  however, it isn't producing any
> > output.  here's the logicsheet:
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <xsl:stylesheet
> >     version="1.0"
> >     xmlns:xsp="http://apache.org/xsp"
> >     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >     xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> >     xmlns:keepsake="http://quotescape.com/keepsake/1.0"
> >     >
> >
> >     <xsl:template match="xsp:page">
> >         <xsp:page>
> >
> >             <xsl:apply-templates select="@*"/>
> >
> >             <xsp:structure>
> >                 <xsp:include>java.util.Map</xsp:include>
> >                 <xsp:include>java.util.HashMap</xsp:include>
> >             </xsp:structure>
> >
> >             <xsp:logic>
> >                 private String getItemProperty(String property) {
> >                     Map currentItem =
> > (Map)request.getSession(true).getAttribute("current-item");
> >
> >                     currentItem.put("id", "39");
> >                     currentItem.put("name", "my item");
> >                     currentItem.put("image", "image name");
> >
> >                     if (currentItem != null &amp;&amp;
> > !currentItem.isEmpty()) {
> >                         if (property.equalsIgnoreCase("id"))
> >                             return currentItem.get("id").toString();
> >
> >                         else if (property.equalsIgnoreCase("name"))
> >                             return currentItem.get("name").toString();
> >
> >                         else if (property.equalsIgnoreCase("image"))
> >                             return currentItem.get("image").toString();
> >                     }
> >
> >                     return "";
> >                 }
> >             </xsp:logic>
> >
> >             <!-- process the rest of the XSP page -->
> >             <xsl:apply-templates/>
> >
> >         </xsp:page>
> >     </xsl:template>
> >
> >     <xsl:template match="keepsake:get-item">
> >
> >         <xsl:choose>
> >             <xsl:when test="@property = 'id'">
> >                 "<xsp:expr>getItemProperty("id")</xsp:expr>"
> >             </xsl:when>
> >             <xsl:when test="@property = 'name'">
> >                 "<xsp:expr>getItemProperty("name")</xsp:expr>"
> >             </xsl:when>
> >             <xsl:when test="@property = 'image'">
> >                 "<xsp:expr>getItemProperty("image")</xsp:expr>"
> >             </xsl:when>
> >         </xsl:choose>
> >
> >     </xsl:template>
> >
> >     <!-- passthrough all other XML data not matched here -->
> >     <xsl:template match="node()|@*">
> >
> >         <xsl:copy>
> >             <xsl:apply-templates select="@*"/>
> >         </xsl:copy>
> >
> >     </xsl:template>
> > </xsl:stylesheet>
> >
> > and here's the xsp that uses it:
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <xsp:page
> >     language="java"
> >     xmlns:xsp="http://apache.org/xsp"
> >     xmlns:keepsake="http://quotescape.com/keepsake/1.0"
> >     create-session="true"
> >     >
> >
> >     <current-product>
> >         <current-item>
> >             <request-uri><xsp-request:get-uri/></request-uri>
> >             <id><keepsake:get-item property="id"/></id>
> >             <name><keepsake:get-item property="name"/></name>
> >             <image><keepsake:get-item property="image"/></image>
> >         </current-item>
> >     </current-product>
> > </xsp:page>
> >
> > thanks in advance for any insights you can provide.
> >
> > Mike Lenyon
>
>
> ---------------------------------------------------------------------
> 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: logicsheet not producing output

Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Mike,

you seem to have a little problem in your logicsheet. You only copy and 
modify your <xsp:page> element. But the next <current-product> is 
missing an <xsl:apply-templates/> in the pass-through template:

 >     <!-- passthrough all other XML data not matched here -->
 >     <xsl:template match="node()|@*">
 >
 >         <xsl:copy>
 >             <xsl:apply-templates select="@*"/>

<xsl:apply-templates/>

 >         </xsl:copy>
 >
 >     </xsl:template>

Regards,

Joerg

Mike Lenyon wrote:
> hi all,
>  
> i've created a simple logicsheet which compiles without errors and runs 
> without producing an error messages.  however, it isn't producing any 
> output.  here's the logicsheet:
> <?xml version="1.0" encoding="UTF-8"?>
>  
> <xsl:stylesheet
>     version="1.0"
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>     xmlns:keepsake="http://quotescape.com/keepsake/1.0"
>     >
>    
>     <xsl:template match="xsp:page">
>         <xsp:page>
>        
>             <xsl:apply-templates select="@*"/>
>            
>             <xsp:structure>
>                 <xsp:include>java.util.Map</xsp:include>
>                 <xsp:include>java.util.HashMap</xsp:include>
>             </xsp:structure>
>            
>             <xsp:logic>
>                 private String getItemProperty(String property) {
>                     Map currentItem = 
> (Map)request.getSession(true).getAttribute("current-item");
>                
>                     currentItem.put("id", "39");
>                     currentItem.put("name", "my item");
>                     currentItem.put("image", "image name");
>                    
>                     if (currentItem != null &amp;&amp; 
> !currentItem.isEmpty()) {
>                         if (property.equalsIgnoreCase("id"))
>                             return currentItem.get("id").toString();
>                            
>                         else if (property.equalsIgnoreCase("name"))
>                             return currentItem.get("name").toString();
>                            
>                         else if (property.equalsIgnoreCase("image"))
>                             return currentItem.get("image").toString();
>                     }
>                    
>                     return "";
>                 }
>             </xsp:logic>
>        
>             <!-- process the rest of the XSP page -->
>             <xsl:apply-templates/>
>            
>         </xsp:page>
>     </xsl:template>
>    
>     <xsl:template match="keepsake:get-item">
>        
>         <xsl:choose>
>             <xsl:when test="@property = 'id'">
>                 "<xsp:expr>getItemProperty("id")</xsp:expr>"
>             </xsl:when>
>             <xsl:when test="@property = 'name'">
>                 "<xsp:expr>getItemProperty("name")</xsp:expr>"
>             </xsl:when>
>             <xsl:when test="@property = 'image'">
>                 "<xsp:expr>getItemProperty("image")</xsp:expr>"
>             </xsl:when>
>         </xsl:choose>
>        
>     </xsl:template>
>    
>     <!-- passthrough all other XML data not matched here -->
>     <xsl:template match="node()|@*">
>    
>         <xsl:copy>
>             <xsl:apply-templates select="@*"/>
>         </xsl:copy>
>        
>     </xsl:template>
> </xsl:stylesheet>
>  
> and here's the xsp that uses it:
> <?xml version="1.0" encoding="UTF-8"?>
>  
> <xsp:page
>     language="java"
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:keepsake="http://quotescape.com/keepsake/1.0"
>     create-session="true"
>     >
>    
>     <current-product>
>         <current-item>
>             <request-uri><xsp-request:get-uri/></request-uri>
>             <id><keepsake:get-item property="id"/></id>
>             <name><keepsake:get-item property="name"/></name>
>             <image><keepsake:get-item property="image"/></image>
>         </current-item>
>     </current-product>
> </xsp:page>
>  
> thanks in advance for any insights you can provide.
>  
> Mike Lenyon


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org