cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Heinen <coc...@ml.icemark.net>
Subject Cocoon 2.0 -> 2.1 transition question: call-template with nodes (fwd)
Date Wed, 29 Dec 2004 14:57:12 GMT

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





   Benedikt

 	INFLUENCE, n.  In politics, a visionary _quo_ given in exchange
 	  for a substantial _quid_.
 			(Ambrose Bierce, The Devil's Dictionary)


Mime
View raw message