xsl-list
[Top] [All Lists]

Re: [xsl] "Return" from a function?

2006-06-01 02:31:22
On 6/1/06, Phillip B Oldham <phillip(_dot_)oldham(_at_)kilo75(_dot_)com> wrote:
Though, thinking about it, I suppose I could do something like the
following (thanks *Andrew*):

<xsl:template match="/subscriptions/item[renewaldate]">
<p>Your renewal date for <xsl:value-of select="subscriptionname" /> is:
<xsl:value-of select="renewaldate" />.</p>
</xsl:template>

<xsl:template match="/subscriptions/item[not(renewaldate)]">
<p>Sorry, there has been an error...</p>
</xsl:template>

Feels weird though, because actions for the same element aren't being
kept "together" (within the same template), but it does look more useful
than a return.

I think, you can write

<xsl:template match="/subscriptions/item">
  <xsl:choose>
     <xsl:when test="renewaldate">
        <p>Your renewal date for <xsl:value-of select="subscriptionname" /> is:
        <xsl:value-of select="renewaldate" />.</p>
    </xsl:when>
    <xsl:otherwise>
       <p>Sorry, there has been an error...</p>
    </xsl:otherwise>
</xsl:template>

Regards,
Mukul

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>