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

RE: avoiding assignment statements

Subject: RE: avoiding assignment statements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 8 Dec 2006 16:07:18 -0000
RE:  avoiding assignment statements
In 2.0:

<xsl:value-of select="string-join(
    ('Reps'[$showreplicates=1], 'MetaData'[$showMetadata=1],
'Signatures'[$showElectronicSignature=1]),
     ', ')"/> 

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: scarleton@xxxxxxxxx [mailto:scarleton@xxxxxxxxx] On 
> Behalf Of Sam Carleton
> Sent: 08 December 2006 14:03
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  avoiding assignment statements
> 
> I have three global xsl:param's which I need to display if 
> any of them are selected:
> 
>   <xsl:param name="showReplicates" select="1"/>
>   <xsl:param name="showMetadata" select="1"/>
>   <xsl:param name="showElectronicSignature" select="1"/>
> 
> if all the flags are turned on, the output would be:
> 
> (View - Reps, Meta-Data, Signatures)
> 
> Normally I would do something like this:
> 
> bool isFirst = true
> 
> if(showReplicates == 1) {
>    Output("Reps");
>    isFirst = false;
> }
> 
> if(showMetadata == 1) {
>    if(isFirst == false) Output(", ");
>    Output("Meta-Data");
>    isFirst = false;
> }
> 
> if(showElectronicSignature == 1) {
>    if(isFirst == false) Output(", ");
>    Output("Signatures");
>    isFirst = false;
> }
> 
> if(isFirst == true) {
>    Output("Only Summary");
> }
> 
> The question is:  How do I do the same thing in the 
> Functional Programming world?
> --
> Miltonstreet Photography
> http://www.miltonstreet.com

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.