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

Re: Creating Multiple Variables

Subject: Re: Creating Multiple Variables
From: allan.mccluskey@xxxxxxxxxxxxxxxxx
Date: Fri, 8 Aug 2003 12:01:12 +1000
xsl if test multiple
Thanks. But wouldn't these variables be out of scope if you want to use
them outside of the for-each?

e.g.  wouldn't this be incorrect


<xsl:for-each select="control/screen/width[@screenWidth='1024']">
    <xsl:variable name="a">1<xsl:variable>
    <xsl:variable name="b">2<xsl:variable>
    <xsl:variable name="c">3<xsl:variable>
</xsl:for-each>

<xsl:value-of select="$a"/>



                                                                                                                                                
                      Adriaan Woerléé                                                                                                           
                      <ade@xxxxxxx>                     To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                               
                      Sent by:                          cc:                                                                                     
                      owner-xsl-list@xxxxxxxxxxx        Subject:  Re:  Creating Multiple Variables                                         
                      rrytech.com                                                                                                               
                                                                                                                                                
                                                 |---------------------|                                                                        
                      08/08/2003 11:25           | ( ) Urgent(4 hours) |                                                                        
                      Please respond to xsl-list | (*) Normal(24-48)   |                                                                        
                                                 | ( ) Low(72 hours)   |                                                                        
                                                 |---------------------|  Expires on                                                            
                                                                                                                                                
                                                                                                                                                
                                                                                                                                                
                                                                                                                                                
                                                                                                                                                





<xsl:for-each select="control/screen/width[@screenWidth='1024']">
    <xsl:variable name="a">1<xsl:variable>
    <xsl:variable name="b">2<xsl:variable>
    <xsl:variable name="c">3<xsl:variable>
</xsl:for-each>
<xsl:for-each select="control/screen/width[@screenWidth!='1024']">
    <xsl:variable name="x">10<xsl:variable>
    <xsl:variable name="y">11<xsl:variable>
    <xsl:variable name="z">12<xsl:variable>
</xsl:for-each>

???
:)

> Hi,
>
> I have some XML that contains an element called SCREENWIDTH which
contains
> the users screen resolution. Once I grabe this value, I want to create
> several variables based on the value (e.g. 800 or 1024) i.e. if it's 1024
> then set variables A, B and C to X, Y and Z --> if it's 800 then set A, B
> and C to L, M and N.
>
> Can someone please tell me the most effecient way to do this??
>
> This is what I have so far...
>
> <xsl:variable name="screenWidth" select="control/screen/width"/>
>
>       <xsl:variable name="headerWidth">
>             <xsl:if test="$screenWidth=1024">
>                   <!-- set a variable -->
>             </xsl:if>
>             <xsl:if test="not($screenWidth=1024)">
>                   <!-- set a variable -->
>             </xsl:if>
>       </xsl:variable>
>
>       <xsl:variable name="table1Width">
>             <xsl:if test="$screenWidth=1024">
>                   <!-- set a variable -->
>             </xsl:if>
>             <xsl:if test="not($screenWidth=1024)">
>                   <!-- set a variable -->
>             </xsl:if>
>       </xsl:variable>
>
>       <xsl:variable name="table2Width">
>             <xsl:if test="$screenWidth=1024">
>                   <!-- set a variable -->
>             </xsl:if>
>             <xsl:if test="not($screenWidth=1024)">
>                   <!-- set a variable -->
>             </xsl:if>
>       </xsl:variable>
>
> etc etc.
>
> Many thanks,
> Allan
>
>
>
>
> Important:  This e-mail is intended for the use of the addressee and may
> contain information that is confidential, commercially valuable or
subject
> to legal or parliamentary privilege.  If you are not the intended
> recipient you are notified that any review, re-transmission, disclosure,
> use or dissemination of this communication is strictly prohibited by
> several Commonwealth Acts of Parliament.  If you have received this
> communication in error please notify the sender immediately and delete
all
> copies of this transmission together with any attachments.
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list







 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.