cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia Conforto <>
Subject Re: XSLT Transformation error in C2.2
Date Tue, 11 Sep 2007 09:20:12 GMT
S├ębastien Geindre wrote:
> I try to do this in a xslt stylesheet :
> <xsl:variable name="top" select="if(($type='cb') and ($typeName!='wims:statusweatherproduct'))
then 'max_fub' else 'top'"/>

"if (...) then ... else ..." is not an XPath 1.0 expression!

You have a few options.
One is to use standard XSLT constructs:

<xsl:variable name="top">
    <xsl:when test="$type='cb' and $typeName!='wims:...'">max_fub</xsl:when>

Another is to define a custom function:

<func:function name="my:if">
  <xsl:param name="test"/>
  <xsl:param name="then"/>
  <xsl:param name="else" select="false()"/>
    <xsl:when test="$test">
      <func:result select="$then"/>
      <func:result select="$else"/>

And then use it like this:

<xsl:variable name="top"
    select="my:if($type='cb' and $typeName!='wims:...', 'max_fub', 'top')"/>

See here for custom functions:

> it works with C2.1

I can't see how.
Maybe it's a custom extension of the XSLT processor you use?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message