> From: Torsten Reiners [mailto:[EMAIL PROTECTED]] > > 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">
Now tell me: what XSL is doing here? Will be: <vormsexample:identifier> > <xsp-request:get-parameter name="identifier"/> Add ending tag: </vormsexample:identifier> And remove this one: > </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"/> Remove this. You pass it differently. And, this is not an XSLT sheet, this is *logicsheet*. > > <xsl:template match="vormsexample:header"> <snip why="irrelevant"/> > </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"/> This is not even valid XSL. And 100% is not workable logicsheet. Have you seen logicsheets shipped with Cocoon? Must be something like: <xsl:variable name="identifier"> <xsl:choose> <xsl:when test="@identifier">"<xsl:value-of select="@identifier"/>"</xsl:when> <xsl:when test="vormsexample:identifier"> <xsl:call-template name="get-nested-content"> <xsl:with-param name="content" select="vormsexample:identifier"/> </xsl:call-template> </xsl:when> <xsl:otherwise>null</xsl:otherwise> </xsl:choose> </xsl:variable> > End of Output > > <!-- <cinclude:include> > <xsp:attribute name="src"> > <xsp:expr>getURI("<xsl:value-of > select="@identifier"/>")</xsp:expr> Nope. Now you have *variable*, and you should use it: <xsp:expr>getURI(<xsl:copy-of select="$identifier"/>)</xsp:expr> Note: No quotes (") ! Because it may contain Java code. And, copy-of instead of value-of: because it may have xsp tags!!! > </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> Remove: > <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> You don't need this for logicsheets. This is *only* for XSL *transformer*. > <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" /> This: > <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> is *not* how you apply a logicsheet. Do you understand this at this moment page is *already* compiled and *executed*? Have you seen logicsheet sample shipped with Cocoon?? I *highly* recommend to understand it prior writing own logicsheets. Go there right now: http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/webapp/docs/samples/xs p/logicsheet.xsp?rev=1.4&content-type=text/vnd.viewcvs-markup Or look in your Cocoon dist. Vadim > <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]>