[xsl] XSL Choose inside a function??

Subject: [xsl] XSL Choose inside a function??
From: Simon Dotschuweit <s_dotschuweit@xxxxxx>
Date: Thu, 24 Oct 2002 18:36:42 +0200
Hello!

I'm a xsl newbie, just to let you know.
my problem is, that I have to write a function with a if-else statement, so I tried it like this:

<xsl:function name="xsl:getParam">
<xsl:param name="class"/>
<xsl:param name="param"/>
<xsl:choose>
  <xsl:when test="$class = '0'">
    <xsl:choose>
      <xsl:when test="$param = '0'">
        <xsl:result select="/jsp_entity/data/bean/fields/pkey"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:result select="/jsp_entity/data/bean/fields/parameter[position()=$param]"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:when>
  <xsl:otherwise>
    <xsl:result select="/jsp_entity/data/bean/classes/helper[position()=$class]/parameter[position()=$param]"/>
  </xsl:otherwise>
</xsl:choose>
</xsl:function> 

but the compiler told me this:

Error at xsl:choose on line 8 of file:/D:/e188/jsp_entity.xsl:
  This element cannot be used within xsl:function
Error at xsl:choose on line 8 of file:/D:/e188/jsp_entity.xsl:
  Element must only be used within a template body
Error at xsl:result on line 12 of file:/D:/e188/jsp_entity.xsl:
  xsl:result must have xsl:function as its parent
Error at xsl:result on line 15 of file:/D:/e188/jsp_entity.xsl:
  xsl:result must have xsl:function as its parent
Error at xsl:result on line 20 of file:/D:/e188/jsp_entity.xsl:
  xsl:result must have xsl:function as its parent

So my question is, is it really not possible to use a choose in a function??

Thank Alot!!
________________________________________________________________
Keine verlorenen Lotto-Quittungen, keine vergessenen Gewinne mehr! 
Beim WEB.DE Lottoservice: http://tippen2.web.de/?x=13



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread