|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: ifdefined test for variable
> '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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








