Could someone help me? I could benefit from a "logicsheet parameters 101"
I want to use my own logicsheet and pass in runtime parameter(s)
I have set up a logicsheet with the namespace mytags and a "function"
get_my_param,
to which I want to pass an xsp/java variable. In the following xsp I have
three goes at passing
a String variable called bag - with the value "56891" - but with no success.
(The logicsheet is based on guesses from what I found in session.xsl,
util.xsl etc.)
.... the results, and the logicsheet follow the listing of the page
Note that the <xsp:expr>bag</xsp:expr> gets 'resolved' in the calling page,
but its value does not get passed into the logicsheet
The <hoo> element shows that a literal value gets passed OK
I guess it's to do with the order in which xsp: and mytags: are 'processed',
but I don't know how to control this - any answers?
<<<<<<<<<<<<<<<< XSP - 'Calling' page >>>>>>>>>>>>>>>>
<?xml version="1.0"?>
<xsp:page
language="java"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:mytags="http://dummy.org/mytags"
>
<xsp:logic>
String bag="56891";
</xsp:logic>
<page>
<rasp>
<xsp:attribute name="bagage"><xsp:expr>bag</xsp:expr></xsp:attribute>
<foo>
<mytags:get_my_param>
<mytags:passed><xsp:expr>bag</xsp:expr></mytags:passed>
</mytags:get_my_param>
</foo>
<goo>
<mytags:get_my_param>
<xsp:attribute name="passed">23</xsp:attribute>
</mytags:get_my_param>
</goo>
<hoo>
<mytags:get_my_param passed="23"/>
</hoo>
</rasp>
</page>
</xsp:page>
<<<<<<<<<<<<<<<< Results >>>>>>>>>>>>>>>>
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsp="http://apache.org/xsp"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:mytags="http://dummy.org/mytags">
<rasp bagage="56891">
<foo>
<myparam horse="bag"/>
</foo>
<goo>
<myparam horse=""/>
</goo>
<hoo>
<myparam horse="23"/>
</hoo>
</rasp>
</page>
<<<<<<<<<<<<<<<< Results try #2 >>>>>>>>>>>>>>>>
If I chaneg the priority of the "copy over" template in the logicsheet
(quoted below), thus:
<xsl:template match="@*|*|text()|processing-instruction()" priority="1">
then I get ...
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsp="http://apache.org/xsp"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:mytags="http://dummy.org/mytags">
<rasp bagage="56891">
<foo>
<mytags:get_my_param>
<mytags:passed>56891</mytags:passed>
</mytags:get_my_param>
</foo>
<goo>
<mytags:get_my_param passed="23">
</mytags:get_my_param>
</goo>
<hoo>
<mytags:get_my_param passed="23"/>
</hoo>
</rasp>
</page>
... which is quite different, but still not what I want !!
<<<<<<<<<<<<<<<< Logicsheet >>>>>>>>>>>>>>>>
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mytags="http://dummy.org/mytags"
version="1.0">
<xsl:template match="mytags:get_my_param">
<xsl:variable name="myparam">
<xsl:call-template name="value-for-passed"/>
</xsl:variable>
<myparam>
<xsl:attribute name="horse"><xsl:value-of
select="$myparam"/></xsl:attribute>
<!--
<myotherparam>
<xsl:attribute name="horse">
<xsl:value-of select="$myotherparam"/>
</xsl:attribute>
</myotherparam>
-->
</myparam>
</xsl:template>
<xsl:template name="value-for-passed">
<xsl:choose>
<xsl:when test="@passed"><xsl:value-of select="@passed"/></xsl:when>
<xsl:when test="mytags:passed">
<xsl:call-template name="get-nested-content">
<xsl:with-param name="content" select="mytags:passed"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</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>
---------------------------------------------------------------------
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]>