Hi,

sorry, the first post was not complete (had different settings for the 
keyboard (CTRL-E for end of line and send email :( )

there is currently a similar question from Zachary A Lendon but so far no 
answer (Vadim did miss some information). I do have the following problem:

I call the following web-page 
http://134.169.75.183:8080/cocoon/example.xsp?identifier="ITWORKS!!!!";. All 
:) I want is to pass the parameter to a logicsheet where the value is used 
for an database request. I use the files as attached to this mail.

Hope, somebody knows a solution or can tell me where I find an example how 
to pass parameter (dynamically) to a logicsheet

Thanks.
Torsten

------------------------------------------- example.xsp 
------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsp:page
         language="java"
         xmlns:xsp="http://apache.org/xsp";
         xmlns:vormsexample="http://www.vorms.org/xsl";
         xmlns:xsp-request="http://apache.org/xsp/request/2.0";
         xmlns:cinclude="http://apache.org/cocoon/include/1.0";>

         <vormsexample:header/>

   <page>
         <vormsexample:link>
            <xsl:attribute name="identifier">
                         <xsp-request:get-parameter name="identifier"/>
            </xsl:attribute>
         </vormsexample:link>

         <!-- THIS WORKS but is not dynamic" -->
         <!--    <vormsexample:link 
identifier="LO_VORMS_TP3_BIBLIOGRAPHY_VOSS_REINERS01_1_1"/>-->
   </page>
</xsp:page>


---------------------------------------------- example.xsl 
------------------------------------------------

<?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:vormsexample="http://www.vorms.org/xsl";
                 xmlns:xsp-request="http://apache.org/xsp/request/2.0";
                 xmlns:cinclude="http://apache.org/cocoon/include/1.0";
                 >

<xsl:param name="identifier"/>

<xsl:template match="vormsexample:header">
   <xsp:structure>
         <xsp:include>DBInterface</xsp:include>
   </xsp:structure>

   <!-- Insert code to the xsl-file to read the uri of the file
        containing the data corresponding to the passed identifier -->

   <xsp:logic>
       public synchronized String getURI(String identifier)
        {


        DBInterface dbinterface = new DBInterface();

       
dbinterface.establishConnection("jdbc:mysql://134.169.75.183/vorms","vorms","vorms");

       String msg = "cocoon:/processed/" + dbinterface.getURIForLM(identifier);
       return msg;
       }
    </xsp:logic>

   <xsl:apply-templates/>
</xsl:template>

<!--  HERE THE PARAMETER SHOULD BE KNOWN (identifier) I DID COMMENT THE 
DATABASE ACCESS IN THIS EXAMPLE ----------------------------- -->
<xsl:template match="vormsexample:link">
Output of identifier:

<xsl:value-of select="identifier"/>

End of Output

<!--             <cinclude:include>
                 <xsp:attribute name="src">
                          <xsp:expr>getURI("<xsl:value-of 
select="@identifier"/>")</xsp:expr>
                 </xsp:attribute>
                 <xsl:apply-templates/>
         </cinclude:include>  -->
         <xsl:apply-templates/>
</xsl:template>


<xsl:template match="@*|node()" priority="-1">
         <xsl:copy>
               <xsl:apply-templates select="@*|node()"/>
         </xsl:copy>
</xsl:template>

</xsl:stylesheet>

-------------------------------------------------------------------------SITEMAP--------------------------------------------------------------------------------------------------
Within the sitemap we use the following declarations

<map:transformers default="xslt">

    <map:transformer name="xslt"            logger="sitemap.transformer.xslt"
                     src="org.apache.cocoon.transformation.TraxTransformer"
                     pool-max="32" pool-min="16" pool-grow="4">
     <use-request-parameters>false</use-request-parameters>
     <use-browser-capabilities-db>false</use-browser-capabilities-db>
     <use-deli>false</use-deli>
    </map:transformer>

    <map:transformer 
name="xslt-with-parameters"            logger="sitemap.transformer.xslt"
                     src="org.apache.cocoon.transformation.TraxTransformer"
                     pool-max="32" pool-min="16" pool-grow="4">
     <use-request-parameters>true</use-request-parameters>
     <use-browser-capabilities-db>false</use-browser-capabilities-db>
     <use-deli>false</use-deli>
    </map:transformer>

</map:transformers>

   <!-- ...... SOME OTHER STUFF -->


   <map:match pattern="example.xsp">
     <map:generate type="serverpages" src="/home/vorms/website/example.xsp"/>
     <map:transform src="/home/vorms/website/vorms_stylesheet.xsl">
         <map:parameter name="view-source" 
value="/home/vorms/website/example.xsp"/>
     </map:transform> -->
     <map:transform type="cinclude" />
     <map:transform type="xslt-with-parameters"
        src="/home/vorms/logicsheets/example.xsl">
        <map:parameter name="use-request-parameters" value="true"/>
        <map:parameter name="identifier" value="identifier"/>
     </map:transform>
     <map:serialize/>
    </map:match>



---------------------------------------------------------------------
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