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

How an "attribute" used a step under (xsl:if) is getti

Subject: How an "attribute" used a step under (xsl:if) is getting assigned to its previous node? Is it the way it is expected to work?
From: "Karlmarx Rajangam" <karlmarx.rajangam@xxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Jun 2007 06:33:10 -0400
 How an "attribute" used a step under (xsl:if) is getti
Hello,

I had a requirement of assigning <input type="radio"> with checked and
disabled options on certain condition.

Since, I know I cannot use something like this,

<input type="checkbox" name="something" value="xx">
	<xsl:attribute name="checked">
		<xsl:if test="@SELECTED = 'true'">checked</xsl:if>
		<!-- actually it was xsl:choose -->
	</xsl:attribute>
	<xsl:attribute name="disabled">
		<xsl:if test="$disableFields = 'true'"> disabled
</xsl:if	</xsl:attribute>
</input>

since, the moment checked or disabled attribute is assigned, the input
radio filed is going to take irrespective of whatever value it was
assigned. But what surprised me was the below code, where the
xsl:attribute is moved inside <xsl:if> one step below, do  working fine.


<input type="checkbox" name="something" value="xx">
	<xsl:if test="@SELECTED = 'true'"><xsl:attribute
name="checked">checked</xsl:attribute></xsl:if>
	<xsl:if test="$disableFields = 'true'"><xsl:attribute
name="disabled">disabled</xsl:attribute></xsl:if>
</input>

I was sure the attribute will become part of <if> statement and won't
work, but my stupid(?) instinct forced to give a try and found it
perfectly assigning checked / disabled attribute to the radio field if
the condition met. It this the way it is supposed to work?


Thanks,
Karl R

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.