You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthieu Benéteau <m....@quaternove.fr> on 2002/04/11 15:44:40 UTC

RE: XSLT named teplates and xsl:param (is it a BUG?)

You have to use :

   <xsl:value-of select="$cssClassNormal"/>
   <xsl:value-of select="$cssClassWeekEnd"/>
   <xsl:value-of select="$dayofweek"/>

etc...

Matthieu


> I'm using Cocoon 2.0.2 and Tomcat 3.3.1.
> 
> Can anybody explain to me why i can't use 'xsl:param' in 'xsl:if'
> clause?
> 
> Example:
> 
> <xsl:template name="TimeCell">
> 	<xsl:param name="cssClassNormal">TimeCell</xsl:param>
> 	<xsl:param name="cssClassWeekEnd">HolidayCell</xsl:param>
> 	<xsl:param name="dayofweek">
> 	<!-- Monday -->
> 		2
> 	</xsl:param>
> 	<td class="{$cssClassNormal}">
> 	<xsl:if test="{$dayofweek}=1 or {$dayofweek}=7">
> 		<xsl:attribute 
> name="class">{$cssClassWeekEnd}</xsl:attribute>
> 	</xsl:if>
> 	<xsl:value-of select="."/>
> 	</td>
> </xsl:template>
> 
> it throws:
> 
> org.apache.cocoon.ProcessingException: Exception in creating Transform
> Handler: javax.xml.transform.TransformerException: Extra illegal tokens:
> '{', '$', 'dayofweek}', '=', '1', 'or', '{', '$', 'dayofweek}', '=', '7'
> 	at
> org.apache.cocoon.components.xslt.XSLTProcessorImpl.getTransformer
> Handler(XSLTProcessorImpl.java:271)


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: XSLT named teplates and xsl:param (is it a BUG?)

Posted by KOZLOV Roman <r-...@opencascade.com>.
Indeed, it seems that error message says that you needn't curved brackets in
test attribute. Try this

<xsl:if test="($dayofweek=1) or ($dayofweek=7)">

or even something like this

<xsl:if test="/[($dayofweek=1) or ($dayofweek=7)]">

And, of course, you have to use xsl:value-of whithin xsl:attribute element.

Roman

Matthieu Benéteau wrote:

> You have to use :
>
>    <xsl:value-of select="$cssClassNormal"/>
>    <xsl:value-of select="$cssClassWeekEnd"/>
>    <xsl:value-of select="$dayofweek"/>
>
> etc...
>
> Matthieu
>
> > I'm using Cocoon 2.0.2 and Tomcat 3.3.1.
> >
> > Can anybody explain to me why i can't use 'xsl:param' in 'xsl:if'
> > clause?
> >
> > Example:
> >
> > <xsl:template name="TimeCell">
> >       <xsl:param name="cssClassNormal">TimeCell</xsl:param>
> >       <xsl:param name="cssClassWeekEnd">HolidayCell</xsl:param>
> >       <xsl:param name="dayofweek">
> >       <!-- Monday -->
> >               2
> >       </xsl:param>
> >       <td class="{$cssClassNormal}">
> >       <xsl:if test="{$dayofweek}=1 or {$dayofweek}=7">
> >               <xsl:attribute
> > name="class">{$cssClassWeekEnd}</xsl:attribute>
> >       </xsl:if>
> >       <xsl:value-of select="."/>
> >       </td>
> > </xsl:template>
> >
> > it throws:
> >
> > org.apache.cocoon.ProcessingException: Exception in creating Transform
> > Handler: javax.xml.transform.TransformerException: Extra illegal tokens:
> > '{', '$', 'dayofweek}', '=', '1', 'or', '{', '$', 'dayofweek}', '=', '7'
> >       at
> > org.apache.cocoon.components.xslt.XSLTProcessorImpl.getTransformer
> > Handler(XSLTProcessorImpl.java:271)
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>