BizTalk Utilities CV ,   Jobs ,   Code library  
 
 
Page 18 of 28

 

Previous Page Table Of Contents Next Page

XSLT Tutorial

XSLT Elements: xsl:choose / xsl:when / xsl:otherwise

xsl:choose / xsl:when / xsl:otherwise

The xsl:if element was pretty restrictive in that it only allows for one test.  The xsl:choose element allows multiple choices in a query.  

<xsl:choose>
    <xsl:when test=boolean expression> 
        template body
    </xsl:when>
    <xsl:otherwise>
        template body
    </xsl:otherwise>
</xsl:choose>

xsl:choose
  • The xsl:choose element is a conditional template which defines a choice between alternatives.
  • It is similar to if-then-else statements, switch statements or select statements found in other languages.
  • There are no attributes for the xsl:choose statement.
xsl:when
  • The number of xsl:when instructions is limitless.
  • There must always be at least one in the body of the xsl:choose element.
  • The criteria for the test expression are the same rules found in the xsl:if element.
  • The first xsl:when statement met will be processed.  Thereafter it breaks out of the xsl:choose conditional template.
xsl:otherwise
  • If none of the above xsl:when criteria are met, then follow the xsl:otherwise instructions.
  • It is optional in the body of the xsl:choose element.
  • It has to be the last child of the xsl:choose element.

 Open Worksheet 6 for an xsl:choose example

Page 18 of 28

 

Previous Page Table Of Contents Next Page
 

Recent Jobs

Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C
Sr. Software Engineer

View all Jobs (Add yours)
View all CV (Add yours)



conference calls
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses
Private Label Hosting
conference call service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP