Re: Can func:function return a xsl:message with nodes inside the xsl:message?

Christine Li <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>



Hi, Shaun

Thanks for your message. It may be a bug in Xalan, I am more interested to
learning the right behavior according to EXSLT specification. For example,
will the following code work? What kinds of xsl elements can be used in
this case. Spec says "It is an error if the instantiation of the template
results in the generation of result nodes"
[http://www.exslt.org/func/elements/function/index.html]

<func:function name="my:test">
  <xsl:param name="type"/>
  <xsl:choose>
  <xsl:when test="$type='A'">
  <func:result select="1"/>
  </xsl:when>
  <xsl:when test="$type='B'">
  <func:result select="2"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:fallback>
    Error
    </xsl:fallback>
  </xsl:otherwise>
  </xsl:choose>
</func:function>

Thanks,

Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: [email protected]


|---------+--------------------------------->
|         |           Shaun McCance         |
|         |           <[email protected]>    |
|         |           Sent by:              |
|         |           [email protected]|
|         |           thought.com           |
|         |                                 |
|         |                                 |
|         |           09/30/2003 04:06 PM   |
|         |                                 |
|---------+--------------------------------->
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                             |
  |       To:       [email protected]                                                                                                 |
  |       cc:                                                                                                                                   |
  |       Subject:  Re: [exslt] Can func:function return a xsl:message with nodes     inside the xsl:message?                                   |
  |                                                                                                                                             |
  |                                                                                                                                             |
  >---------------------------------------------------------------------------------------------------------------------------------------------|



On Tue, 2003-09-30 at 11:17, Christine Li wrote:
>
>
> Hello,
>
> Could someone help me to verify the right results of the func:function? I
> have following code, currently it doesn't work with Xalan. It throws
error
> that says "misplace literal result in a func:function container"
>
> <func:function name="my:test">
>   <xsl:param name="type"/>
>   <xsl:choose>
>   <xsl:when test="$type='B'">
>     <func:result select="2"/>
>   </xsl:when>
>   <xsl:otherwise>
>     <xsl:message>
>       Error
>     </xsl:message>
>   </xsl:otherwise>
>   </xsl:choose>
> </func:function>
>
> <xsl:template match="foo">
>   <xsl:value-of select="my:test(@Name)"/>
> </xsl:template>

This works in the libxslt implementation.  You should probably talk to
whoever implemented EXSLT functions in Xalan.

--
Shaun


_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.