cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel Alfred" <Alfred.Nathan...@swx.com>
Subject RE: A xsp simple question
Date Sun, 23 Oct 2005 08:06:23 GMT
Logicsheets are not defined in the sitemap but either in cocoon.xconf or in the XSP itself.
To start with, it is simpler to define it in the XSP.  Put in greeting3.xsp
 
<xsp:logicsheet location="logicsheet.greetings.xsl"/>
 
before <xsp:page> and remove the map:transform from the sitemap.
 
HTH, Alfred.
 
-----Original Message-----
From: Kerstin Nordqvist [mailto:Kerstin.Nordqvist@mobeon.com]
Sent: Samstag, 22. Oktober 2005 16:00
To: users@cocoon.apache.org
Subject: A xsp simple question



Hi

I have again a very simple question. I am trying to use the xsp-guide included in the cocoon-2.1.7.
The examples is without sitemap.xmap, but I am trying the make them work anyway.

Simple XSP Logicsheet Example:

greeting3.xsp

<?xml version="1.0"?>

<xsp:page
  xmlns:xsp="  <http://apache.org/xsp> http://apache.org/xsp"
  xmlns:greeting="  <http://duke.edu/tutorial/greeting> http://duke.edu/tutorial/greeting">

  <greeting>
    <greeting:hello-world/>
  </greeting>

</xsp:page>



  _____  


logicsheet.greeting.xsl



<?xml version="1.0"?>

<xsl:stylesheet

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  xmlns:xsp="http://apache.org/xsp"

  xmlns:greeting="http://duke.edu/tutorial/greeting"

  version="1.0">



<xsl:template match="xsp:page">

 <xsl:copy>

  <xsl:apply-templates select="@*"/>

  <xsl:apply-templates/>

 </xsl:copy>

</xsl:template>



<xsl:template match="greeting:hello-world">

  <!-- more complex XSLT is possible here as well -->

  <xsp:logic>

    // this could be arbitrarily complex Java code, JDBC queries, etc.

    String msg = "Hello, world!";

  </xsp:logic>

  <xsp:expr>msg</xsp:expr>

</xsl:template>



<!-- This template simply copies stuff that doesn't match other -->

<!-- templates and applies templates to any children.           -->

<xsl:template match="@*|node()" priority="-1">

 <xsl:copy>

  <xsl:apply-templates select="@*|node()"/>

 </xsl:copy>

</xsl:template>



</xsl:stylesheet>
  _____  

sitemap.xmap    
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map=" http://apache.org/cocoon/sitemap/1.0">
 <map:pipelines>
  <map:pipeline>
    <map:match pattern="*.xsp">
     <map:generate type="serverpages" src="{1}.xsp"/>
     <map:transform src="logicsheet.greeting.xsl">
      <map:parameter name="contextPath"
                     value="{request:contextPath}"/>
     </map:transform> 
     <map:serialize type="html"/>
    </map:match>
  </map:pipeline>
 </map:pipelines>
</map:sitemap>

  _____  

The result I will get in the web browser is:
 
// this could be arbitrarily complex Java code, JDBC queries, etc. String msg = "Hello, world!";
msg  
 
  _____  

 
source code :
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<greeting xmlns:xsp=" http://apache.org/xsp" xmlns:greeting=" http://duke.edu/tutorial/greeting">
    <xsp:logic language="java">
    // this could be arbitrarily complex Java code, JDBC queries, etc.
    String msg = "Hello, world!";
  </xsp:logic>
<xsp:expr>msg</xsp:expr>
  
</greeting>

  _____  

 
It seams like the xsp code does not evolve. Why ? Can someone please help me.
 
When I am trying to use xsp in my xsl file, when transforming an xml file to a html file,
the same thing happens and all html coding disappears.
 
Regards,
Kerstin
 
 
This message is for the named person's use only. It may contain confidential, proprietary
or legally privileged information. No confidentiality or privilege is waived or lost by any
mistransmission. If you receive this message in error, please notify the sender urgently and
then immediately delete the message and any copies of it from your system. Please also immediately
destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail communications through their
networks. Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorised to state them to be the views of
the sender's company.

Mime
View raw message