[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: "Return" from a function?

Subject: Re: "Return" from a function?
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 1 Jun 2006 15:01:02 +0530
Re:  "Return" from a function?
On 6/1/06, Phillip B Oldham <phillip.oldham@xxxxxxxxxx> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.