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

Re: ifdefined test for variable

Subject: Re: ifdefined test for variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 6 Aug 1999 09:37:25 +0100 (BST)
xsl attribute onload
> 'if defined' test on a variable?

No, because either it is defined, or trying to reference it in a test
would generate an error.

your $onload variable must have some value always, perhaps in your
`false' case it is the empty string, or null node list

so you could do something like

<xsl:if test=" ''= $onload">
    <xsl:attribute name="onload">$onload</xsl:attribute>
</xsl:if>

or even, given the coersion of non empty strings to boolean true:

<xsl:if test="$onload">
    <xsl:attribute name="onload">$onload</xsl:attribute>
</xsl:if>

However it is possibly easier just to not bother with the test and just
go

<xsl:copy-of select="$onload"/>

where onload has value either a null result tree fragment, or
the result of running
 <xsl:attribute name="onload">something</xsl:attribute>

David


 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.