cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Cocoon 2.0 -> 2.1 transition question: call-template with nodes (fwd)
Date Wed, 29 Dec 2004 21:47:11 GMT
Benedikt Heinen wrote:

>
> [I posted the following message to the cocoon-users list before, but I 
> didn't get any answers at all there; maybe one of the developers round 
> here knows?]
>
>
> I'm trying to move from cocoon 2.0 to 2.1, but I am having trouble 
> getting some of my old stylesheets to work in 2.1.
>
> Specifically, some of the style sheets passed template methods with 
> nodes being passed as parameters - Cocoon 2.1 only seems to pass in 
> the text within the nodes, hence further disection of the parameter 
> isn't possible and yields "invalid xpath" exceptions.
>
> More specifically, I have a method to pick out a title string for the 
> current element to be processed (the "elem" parameter passed into 
> titleStr is an element):
>
>         <xsl:call-template name="titleStr">
>           <xsl:with-param name="elem" select="title" />
>         </xsl:call-template>
>
> The template is defined as such:
>
>     <xsl:template name="titleStr">
>       <xsl:param name="elem" />
>       <xsl:choose>
>         <xsl:when test="$elem[@lang=$plang]">
>           <xsl:value-of select="$elem[@lang=$plang]" />
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:value-of select="$elem" />
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:template>
>
>
> [[[ short addition: the input would be triggered during processing of 
> a section element, which would look roughly like this:
>
>   <section id="section-ref-01">
>     <title lang="de">german section title</title>
>     <title lang="en">english section title</title>
>
>     [other content]
>   </section>
> ]]]
>
>
>
> I have several named templates in this fashion, this is the easiest 
> one (others start making selections to other tags relative to their 
> own; and/or do recursive calls). Also, some of these named templates 
> get called several times, for different elements during a single 
> stylesheet process, so I wouldn't like to duplicate the code into the 
> various places...
>
>
> Is there a specific reason, that Cocoon 1.8 and Cocoon 2.0 could deal 
> with this, and 2.1 doesn't seem to be able to?


Where does the "$plang" parameter come from? Is it a request parameter? 
If so, you should check that the "use-request-parameters" is properly 
set to true in your transformer's configuration.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message